Giter Club home page Giter Club logo

gonzales-pe's Introduction

Gonzales is a fast CSS parser.
Gonzales PE is a rework with support of preprocessors.

Currently those are supported: SCSS, Sass, LESS.

For a plan of future work see issue #4.

Install

To install globally:

npm install [email protected] -g

To install as a project dependency:

npm install [email protected]

To install dev branch:

npm install git://github.com/tonyganch/gonzales-pe.git#dev

To clone from github:

git clone [email protected]:tonyganch/gonzales-pe.git

Build

If you installed/cloned the repo from GitHub, make sure to build library files first.
It can be done by running make in the module's root directory.
make will build both Node.js and web versions (all files are comments-free but not compressed).
If you need a minified version for production, feel free to use uglifier of your choice.

Use

Require Gonzales in your project:

var gonzales = require('gonzales-pe');

Do something:

var css = 'a { color: tomato }';
console.log(gonzales.cssToAST(css));

You can learn more about available methods on Gonzales usage page.

AST is described on Gonzales AST description page.

Test

To run tests:

npm test

This command will build library files from sources and run tests on all files in syntax directories.

Every test has 3 files: source stylesheet, expected AST and expected string compiled back from AST to css.

If some tests fail, you can find information in test logs:

  • log/test.log contains all information from stdout;
  • log/expected.txt contains only expected text;
  • log/result.txt contains only result text.

The last two are made for your convenience: you can use any diff app to see the defference between them.

If you want to test one specific string or get a general idea of how Gonzales works, you can use test/ast.js file.
Simply change the first two strings (css and syntax vars) and run:

node test/ast.js

Please remember to also run make every time you modify any source files.

Report

If you find a bug or want to add a feature, welcome to Issues.

If you are shy but have a question, feel free to drop me a line.

gonzales-pe's People

Contributors

tonyganch avatar afelix avatar arikon avatar varya avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.