Skip to content

danielromeroauk/css2stylus.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript utility to convert CSS into Stylus.

Node/Browser compatible.

Demo

###Try it online css2stylus.com

Usage

Node

Install the module

$ npm install -g css2stylus

Convert any css file:

$ css2stylus myfile.css

The output will be saved to myfile.styl.

Browser

<!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>

Keep CSS syntax

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 });

nib support

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 });

License

See LICENSE.txt

About

JavaScript utility to convert CSS into Stylus

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published