-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathpostcss.config.js
46 lines (42 loc) · 1 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
const fs = require( 'fs' );
const path = require( 'path' );
const request = require( 'request' );
const themeUrl =
'https://raw.githubusercontent.com/WebDevStudios/wd_s/main/wds.preset.js';
const downloadPath = path.join(
path.resolve( __dirname ),
'./fallbackPreset.js'
);
const envPath = path.join( path.resolve( __dirname ), './env.json' );
let { tailwindPreset } = fs.existsSync( envPath )
? require( './env.json' )
: false;
if ( ! fs.existsSync( tailwindPreset ) ) {
if ( ! fs.existsSync( downloadPath ) ) {
request( themeUrl )
.pipe( fs.createWriteStream( downloadPath ) )
.on( 'close', function () {} );
}
tailwindPreset = downloadPath;
}
module.exports = {
plugins: {
tailwindcss: { config: require( tailwindPreset ) },
autoprefixer: { grid: true },
...( process.env.NODE_ENV === 'production'
? {
cssnano: {
preset: [
'default',
{
discardComments: {
removeAll: true,
},
},
],
},
}
: {} ),
},
tailwindPreset,
};