forked from WebDevStudios/wd_s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tailwind.config.js
40 lines (34 loc) · 932 Bytes
/
tailwind.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const fs = require( 'fs' );
const path = require( 'path' );
const glob = require( 'glob' );
// Get arrays of all of the files.
const topLevelPhpFiles = glob.sync( './*.php' ),
directoryFiles = [
'./inc/*.php',
'./template-parts/*.php',
'./src/js/**/*.js',
];
const themeJsonPath = path.join( __dirname, 'theme.json' );
const themeJson = fs.readFileSync( themeJsonPath );
const theme = JSON.parse( themeJson );
const { palette } = theme.settings.color;
const colors = palette.reduce( ( acc, item ) => {
const [ color, number ] = item.slug.split( '-' );
if ( number ) {
// If there is a number identifier, make this an object
if ( ! acc[ color ] ) {
acc[ color ] = {};
}
acc[ color ][ number ] = item.color;
} else {
acc[ color ] = item.color;
}
return acc;
}, {} );
module.exports = {
corePlugins: {
preflight: false,
},
content: topLevelPhpFiles.concat( directoryFiles ),
theme: { colors },
};