Skip to content

Instantly share code, notes, and snippets.

@MichalZalecki
Created October 24, 2015 00:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save MichalZalecki/762d2c4d44869dc04ce6 to your computer and use it in GitHub Desktop.
Save MichalZalecki/762d2c4d44869dc04ce6 to your computer and use it in GitHub Desktop.
Script transpiling CSS with cssnext
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