forked from Blair2004/NexoPOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
postcss.config.js
executable file
·48 lines (44 loc) · 1.67 KB
/
postcss.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
41
42
43
44
45
46
47
48
const fs = require( 'fs' );
const wildcard = require( 'wildcard' );
const path = require( 'path' );
const directory = path.join( __dirname, 'public/css' );
// postcss.config.js
module.exports = (ctx) => {
const files = fs.readdirSync( directory );
if ( ctx.file.basename ) {
files.forEach( file => {
if (
( wildcard( 'app.*.css', file ) || wildcard( 'app.css', file ) ) ||
( wildcard( 'dark.*.css', file ) || wildcard( 'dark.css', file ) ) ||
( wildcard( 'light.*.css', file ) || wildcard( 'light.css', file ) ) ||
( wildcard( 'fonts.*.css', file ) || wildcard( 'fonts.css', file ) ) ||
( wildcard( 'typography.*.css', file ) || wildcard( 'typography.css', file ) ) ||
( wildcard( 'animations.*.css', file ) || wildcard( 'animations.css', file ) )
) {
const path = `${__dirname}/public/css/${file}`;
if( fs.existsSync( path ) ) {
fs.unlinkSync( path );
}
}
});
console.log( `${ ctx.env === 'production' ? 'compiling' : 'watching' }: ${ ctx.file.basename || path.basename( ctx.file ) }` );
return {
syntax: 'postcss-scss',
parser: 'postcss-scss',
plugins: {
'postcss-css-variables': {},
'postcss-import': {},
'postcss-nesting': {},
'autoprefixer': {},
'tailwindcss/nesting': require('tailwindcss/nesting'),
'tailwindcss': require('tailwindcss'),
'postcss-hash': ctx.env === 'production' ? {
algorithm: 'sha256',
trim: 20,
manifest: './public/css-manifest.json'
} : false,
'cssnano': ctx.env === 'production' ? {} : false
}
};
}
}