File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import fs from 'fs'
2+ import postcss from 'postcss'
3+ import tailwind from '..'
4+ import CleanCSS from 'clean-css'
5+
6+ function build ( { from, to, config } ) {
7+ return new Promise ( ( resolve , reject ) => {
8+ console . log ( `Processing ./${ from } ...` )
9+
10+ fs . readFile ( `./${ from } ` , ( err , css ) => {
11+ if ( err ) throw err
12+
13+ return postcss ( [ tailwind ( config ) ] )
14+ . process ( css , {
15+ from : undefined ,
16+ } )
17+ . then ( result => {
18+ fs . writeFileSync ( `./${ to } ` , result . css )
19+ return result
20+ } )
21+ . then ( resolve )
22+ . catch ( error => {
23+ console . log ( error )
24+ reject ( )
25+ } )
26+ } )
27+ } )
28+ }
29+
30+ console . info ( '\nRebuilding fixtures...\n' )
31+
32+ Promise . all ( [
33+ build ( {
34+ from : '__tests__/fixtures/tailwind-input.css' ,
35+ to : '__tests__/fixtures/tailwind-output.css' ,
36+ config : { } ,
37+ } ) ,
38+ build ( {
39+ from : '__tests__/fixtures/tailwind-input.css' ,
40+ to : '__tests__/fixtures/tailwind-output-important.css' ,
41+ config : { important : true } ,
42+ } ) ,
43+ ] ) . then ( ( ) => {
44+ console . log ( '\nFinished rebuilding fixtures.' )
45+ console . log (
46+ '\nPlease triple check that the fixture output matches what you expect before committing this change.'
47+ )
48+ } )
You can’t perform that action at this time.
0 commit comments