Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 137 lines (117 sloc) 2.519 kB
#!/usr/bin/env node
/**
* Module dependencies.
*/
var program = require('commander')
, rework = require('..')
, stdin = process.stdin;
/**
* Prefixed properties.
*/
var props = [
'animation',
'animation-delay',
'animation-direction',
'animation-duration',
'animation-fill-mode',
'animation-iteration-count',
'animation-name',
'animation-play-state',
'animation-timing-function',
'appearance',
'background-visibility',
'background-clip',
'background-composite',
'background-origin',
'background-size',
'blend-mode',
'border-bottom-left-radius',
'border-bottom-right-radius',
'border-fit',
'border-image',
'border-radius',
'border-top-left-radius',
'border-top-right-radius',
'border-vertical-spacing',
'box-align',
'box-direction',
'box-flex',
'box-flex-group',
'box-lines',
'box-ordinal-group',
'box-orient',
'box-pack',
'box-reflect',
'box-shadow',
'box-sizing',
'clip-path',
'flex',
'flex-basis',
'flex-direction',
'flex-flow',
'flex-grow',
'flex-shrink',
'flex-wrap',
'flex-flow-from',
'flex-flow-into',
'font-smoothing',
'transform',
'transform-origin',
'transform-origin-x',
'transform-origin-y',
'transform-origin-z',
'transform-style',
'transition',
'transition-delay',
'transition-duration',
'transition-property',
'transition-timing-function',
'user-drag',
'user-modify',
'user-select',
'wrap',
'wrap-flow',
'wrap-margin',
'wrap-padding',
'wrap-through'
];
// options
program
.version(require('../package.json').version)
.option('-v, --vendors <list>', 'specify list of vendors', list)
.option('--vars', 'add css variable support')
.parse(process.argv);
// --vendors
var vendors = prefix(program.vendors || ['o', 'ms', 'moz', 'webkit']);
// stdin boilerplate...
var str = '';
stdin.setEncoding('utf8');
stdin.on('data', function(chunk){ str += chunk });
stdin.on('end', done);
stdin.resume();
// parse list
function list(str) {
return str.split(/ *, */);
}
// prefix names
function prefix(names) {
return names.map(function(name){
return '-' + name + '-';
});
}
// rework
function done() {
var style = rework(str)
.vendors(vendors)
.use(rework.keyframes())
.use(rework.prefixValue('transform'))
.use(rework.prefix(props))
.use(rework.at2x())
if (program.vars) {
style.use(rework.vars());
}
if (~vendors.indexOf('-ms-')) {
style.use(rework.opacity());
}
process.stdout.write(style.toString());
}
Jump to Line
Something went wrong with that request. Please try again.