Sha256: 9d2d3d61ca88b6d2efadcf71dd98cc7b05212316308232e7081b253d02da28c0
Contents?: true
Size: 1.7 KB
Versions: 2
Compression:
Stored size: 1.7 KB
Contents
/* jshint node: true */ 'use strict'; var fs = require('fs'); var minimist = require('minimist'); var path = require('path'); var pkg = require('../package.json'); var csswring = require('../index'); var _printVersion = function () { console.log('csswring v' + pkg.version); }; var _showHelp = function () { console.log('Usage:'); console.log(' csswring [options] [INPUT] [OUTPUT]'); console.log(''); console.log('Description:'); console.log(' ' + pkg.description); console.log(''); console.log('Options:'); console.log(' --sourcemap Create source map file.'); console.log(' -h, --help Show this message.'); console.log(' -v, --version Print version information.'); }; exports.cli = function (args) { if (args) { _showHelp(); process.exit(1); } var argv = minimist(args, { boolean: [ 'sourcemap', 'help', 'version' ], alias: { h: 'help', v: 'version' }, default: { sourcemap: false, help: false, version: false } }); switch (true) { case argv.version: { _printVersion(); break; } case argv.help: { _showHelp(); break; } default: { var opts = {}; if (argv.sourcemap) { opts.map = true; } opts.from = argv._[0]; if (argv._[1]) { opts.to = argv._[1]; } var wringed = csswring.wring(fs.readFileSync(opts.from, { encoding: 'utf8' }), opts); if (opts.to) { fs.writeFileSync(opts.to, wringed.css); if (opts.map) { fs.writeFileSync(opts.to + '.map', wringed.map); } } else { process.stdout.write(wringed.css); } } } };
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pleeease-0.0.3 | node_modules/pleeease/node_modules/csswring/lib/cli.js |
pleeease-0.0.2 | node_modules/pleeease/node_modules/csswring/lib/cli.js |