forked from tailwindlabs/tailwindcss
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a19875f
commit 375a87a
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import fs from 'fs' | ||
import postcss from 'postcss' | ||
import tailwind from '..' | ||
import CleanCSS from 'clean-css' | ||
|
||
function build({ from, to, config }) { | ||
return new Promise((resolve, reject) => { | ||
console.log(`Processing ./${from}...`) | ||
|
||
fs.readFile(`./${from}`, (err, css) => { | ||
if (err) throw err | ||
|
||
return postcss([tailwind(config)]) | ||
.process(css, { | ||
from: undefined, | ||
}) | ||
.then(result => { | ||
fs.writeFileSync(`./${to}`, result.css) | ||
return result | ||
}) | ||
.then(resolve) | ||
.catch(error => { | ||
console.log(error) | ||
reject() | ||
}) | ||
}) | ||
}) | ||
} | ||
|
||
console.info('\nRebuilding fixtures...\n') | ||
|
||
Promise.all([ | ||
build({ | ||
from: '__tests__/fixtures/tailwind-input.css', | ||
to: '__tests__/fixtures/tailwind-output.css', | ||
config: {}, | ||
}), | ||
build({ | ||
from: '__tests__/fixtures/tailwind-input.css', | ||
to: '__tests__/fixtures/tailwind-output-important.css', | ||
config: { important: true }, | ||
}), | ||
]).then(() => { | ||
console.log('\nFinished rebuilding fixtures.') | ||
console.log( | ||
'\nPlease triple check that the fixture output matches what you expect before committing this change.' | ||
) | ||
}) |