Last active
August 14, 2018 16:16
-
-
Save mariuswilms/651cbcf78bd0564bdfdfc9168c0f9318 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env node | |
/*! | |
* CSS: The Next Generation | |
* | |
* Copyright (c) 2017 Atelier Disko. All rights reserved. This source | |
* code is distributed under the terms of the BSD 3-Clause License. | |
*/ | |
const fs = require('fs'); | |
const postcss = require('postcss'); | |
const atImport = require('postcss-import'); | |
const autoprefixer = require('autoprefixer'); | |
const customProperties = require('postcss-custom-properties'); | |
const flexbugs = require('postcss-flexbugs-fixes'); | |
const url = require('postcss-url'); | |
const matches = require('postcss-selector-matches'); | |
const source = process.argv.pop(); | |
fs.readFile(source, (err, css) => { | |
postcss([ | |
atImport, | |
url, | |
matches, | |
customProperties({preserve: false, warnings: true}), | |
flexbugs, | |
autoprefixer() | |
]) | |
.process(css, { | |
from: source | |
}) | |
.then(result => { | |
process.stdout.write(result.css); | |
result.warnings().forEach(function (warn) { | |
console.warn(warn.toString()); | |
}); | |
}) | |
.catch(error => { | |
console.error(error); | |
process.exit(1); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment