GithubHelp home page GithubHelp logo

subtlegradient / sheet.js Goto Github PK

View Code? Open in Web Editor NEW
61.0 61.0 6.0 208 KB

CommonJS & Browser JavaScript for parsing many CSS-like languages. Parse a CSS string into a JS object!

Home Page: http://subtlegradient.github.com/Sheet.js/Test/

License: MIT License

CSS 7.11% JavaScript 92.73% Shell 0.17%

sheet.js's People

Contributors

nv avatar subtlegradient avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

sheet.js's Issues

Production Use?

Hi Thomas,

Has this been used in production? Is it safe to parse user entered CSS like with JSCSSP without erroring? Is it still under active development?

Cheers,

Jamie

Less CSS

Did you make any progress with parsing Less CSS?

Parse function calls

With CSS3 we've got a ton of cool css functions like gradient, and... whatever, I dont know, I'm interested in that one :) It would be extremely convenient to have function name and all arguments parsed in Sheet.js output.

The thing is sometimes it's like gradient(radial, from(#fff), color-stop(rgb(255,100,30)), to(#000)) then it gets tricky.

`cssText` does not updates

var myStyleSheet = new Sheet("#selector { color:blue }")
myStyleSheet.cssRules[0].style.color = "green"
myStyleSheet.cssRules[0].style.cssText //'color:blue;'

I can fix it by calling update()

myStyleSheet.update()
myStyleSheet.cssRules[0].style.cssText //'color:green;'

but in the browser it works without update method (which actually doesn't exist for CSSStyleSheet).

I expected to see CSSStyleRule class to implement cssText getter, but I didn't found it. The code looks a bit tricky to extend at first glance. Some pointers would be helpful.

Packager support

Sheet.js uses sg-regex-tools.js which is not listed as a dependency, but rather required using common js require syntax. Please make use the extension file.

Parsing error: block comments

this bit of css yields a selector from /**** up to .ws-app, so it's not recognizing those comments properly. The rest (.ws-app .ws-container) is parsed ok.

    /****************************************************************
    *  Home page styling for all screen sizes.
    ****************************************************************/

    /* defaults */
    .ws-app {}
    .ws-app .ws-container {
           margin: 0 auto;
           position: relative;
    }

From: frank06

package.json specifies package root as doc directory

I realize that this is nit-picky, but the package.json "doc" entry under directories is meant to point to a subdirectory containing markdown files. Breaking this standard may not mesh well with upcoming npm features.

JSCSSP?

Have you seen JSCSSP? It's pretty heavy and advanced CSS parser written in JavaScript.

It might make sense to port JSCSSP into CommonJS module instead of writing your own from scratch. Or isn't it?

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.