JavaScript utility to convert CSS into Stylus.
Node/Browser compatible.
###Try it online css2stylus.com
Install the module
$ npm install -g css2stylus
Convert any css file:
$ css2stylus myfile.css
The output will be saved to myfile.styl
.
<!doctype html>
<title>Demo</title>
<script src="css2stylus.js"></script>
<script>
(function () {
var css = 'body { color: red; }';
var converter = new Css2Stylus.Converter(css);
converter.processCss();
// output
var stylus_output = converter.getStylus();
// body
// color red
}());
</script>
To keep CSS punctuation {:;}
just pass --cssSyntax
option from command line.
Or pass options object when processing a CSS file from JavaScript converter.processCss({ cssSyntax: true });
Unprefix any CSS snippet with vendor prefixes by passing --unPrefix
option from command line.
Or pass an options object when processing a CSS file from JavaScript converter.processCss({ unPrefix: true });
See LICENSE.txt