Skip to content
forked from jotform/css.js

A lightweight, battle tested, fast, CSS parser in JavaScript

License

Notifications You must be signed in to change notification settings

jabez128/css.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

css.js

A lightweight, battle tested, fast, css parser in JavaScript

Why?

Please read the story behind it [here] [here]: https://medium.com/jotform-form-builder/writing-a-css-parser-in-javascript-3ecaa1719a43

Demo

Check it out plunker demo

Development

Following commands will prepare development enviroment by installing dependencies:

	npm install
	bower install

And to execute unit tests and produce css.min.js, execute

	grunt

How To Use

Simply parse css string, and log the output

	<script type="text/javascript" src="css.min.js"></script>
	<script type="text/javascript">
		var cssString = ' .someSelector { margin:40px 10px; padding:5px}';
		//initialize parser object
		var parser = new cssjs();
		//parse css string
		var parsed = parser.parseCSS(cssString);

		console.log(parsed);
	</script>

About

A lightweight, battle tested, fast, CSS parser in JavaScript

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%