forked from grnadav/css2js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcss2js
executable file
·27 lines (20 loc) · 924 Bytes
/
css2js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env node
// script to run css2js
var path = require('path'),
fs = require('fs'),
rootPath = path.dirname(fs.realpathSync(__filename)),
node_modules = path.join(rootPath, 'node_modules'),
optimist = require( path.join(node_modules, 'optimist')),
css2js = require(path.join(rootPath, '/app.js'));
if (require.main === module) {
// loaded from command line - require arguments, if fails returns 1
var argv = optimist
.usage('Usage: $0 --css=[path/to/input/css] --out=[path/to/out/js] --template=[vanilla_runner|requirejs_inject|requirejs_runner|<yours!>]')
.demand(['css', 'out', 'template'])
.argv,
cssFileUri = argv.css,
outputFile = argv.out,
template = argv.template,
templatePath = path.join(rootPath, 'templates/' + template + '.js.tim');
return css2js.convert(cssFileUri, templatePath, outputFile);
}