oliverdavies.uk-drupal-old/web/themes/custom/opdavies/tailwind.config.js
Oliver Davies 59620f8a51 Add .theme file to the PurgeCSS config
Ensures that any classes in `opdavies.theme` are not purged in a
production CSS build.

References #341
2021-01-10 22:15:48 +00:00

92 lines
2.3 KiB
JavaScript

const colors = require('./tailwind-colours')
const defaultConfig = require('tailwindcss/defaultConfig')
const defaultTheme = require('tailwindcss/defaultTheme')
const focusVisible = require('./tailwind-plugin-focus-visible')
const typography = require('@tailwindcss/typography')
const { fontFamily } = defaultTheme
const { variants } = defaultConfig
module.exports = {
important: true,
purge: {
content: [
'../../../../config/**/*.yml',
'body-field-values.txt',
'opdavies.theme',
'templates/**/*.twig'
],
options: {
safelist: [
'bg-gray-200',
'block-opdavies-branding'
]
}
},
theme: {
extend: {
typography: (theme) => ({
DEFAULT: {
css: {
a: {
color: theme('colors.blue.500')
},
code: {
backgroundColor: theme('colors.gray.150'),
fontWeight: theme('fontWeight.normal'),
paddingBottom: theme('spacing.px'),
paddingLeft: theme('spacing.1'),
paddingRight: theme('spacing.1'),
paddingTop: theme('spacing.px')
},
h2: {
marginBottom: theme('spacing.2'),
marginTop: theme('spacing.8')
},
pre: {
backgroundColor: theme('colors.gray.150'),
borderRadius: '0',
color: theme('colors.gray.800'),
padding: theme('spacing.6')
},
'code::before': false,
'code::after': false,
'pre code::before': false,
'pre code::after': false
}
}
}),
colors,
fontFamily: {
mono: [
'Operator Mono',
'Roboto Mono',
...fontFamily.mono
]
},
spacing: {
'2px': '2px'
},
borderWidth: {
3: '3px'
},
width: {
96: '24rem'
}
}
},
corePlugins: {
container: false
},
plugins: [
focusVisible,
typography
],
variants: {
borderColor: [...variants.borderColor, 'focus-visible'],
borderStyle: [...variants.borderStyle, 'hover', 'focus'],
borderWidth: [...variants.borderWidth, 'hover', 'focus'],
margin: [...variants.margin, 'first', 'last', 'odd', 'even'],
typography: ['responsive']
}
}