Created
October 24, 2015 00:01
-
-
Save MichalZalecki/762d2c4d44869dc04ce6 to your computer and use it in GitHub Desktop.
Script transpiling CSS with cssnext
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
const cssnext = require("cssnext"); | |
const fs = require("fs"); | |
const watch = require("node-watch"); | |
const program = require("commander"); | |
program | |
.version("0.0.1") | |
.option("-s, --source [path]", "Source file") | |
.option("-d, --destination [path]", "Destination file") | |
.option("-w, --watch [path]", "Watch directory") | |
.parse(process.argv); | |
function make() { | |
const output = cssnext( | |
fs.readFileSync(program.source, "utf8"), | |
{from: program.source} | |
); | |
fs.writeFileSync(program.destination, output); | |
console.log(`Created: ${program.destination}`); | |
} | |
make(); | |
program.watch && watch(program.watch, make); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment