GithubHelp home page GithubHelp logo

hhy5277 / sheet.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from subtlegradient/sheet.js

0.0 1.0 0.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 Introduction

Sheet.js by Thomas Aylott of MooTools

STATE: well tested and stable

This project uses semver.org standard version numbering.

Sheet.js

Parse CSS in JavaScript

  • Test-first Development
  • UniversalJS
  • Zero dependencies
  • DOM-less (no document necessary)
  • CommonJS Modules 1.0+ with global fallback
  • Browser support
  • Implements W3C document.styleSheets API
  • Implements WebKit CSS Animation API

Flexible Parsing

  • Supports WebKit CSS Animation syntax
  • Supports custom selectors, @rules, properties and values
  • Supports nested rules
  • Supports HTML style attribute values
    i.e. CSS rules without the selectors and brackets

Coming Soon…

  • Support for custom CSS-like languages like the Sass 3.0 SCSS (Sassy CSS) and Less CSS

Basic Usage

ClientSide / Browser Usage

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

ServerSide / CommonJS Usage

require.paths.push('path/to/Sheet.js/Source'); // You might not need this
var Sheet = require('Sheet').Sheet;

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

Advanced ClientSide Namespacing

If you need to move Sheet.js to its own custom namespace simply define a global exports object before loading Sheet.js. Sheet.js will see that object, assume that it's in a CommonJS environment and then attach itself onto that object instead of including itself globally.

You really shouldn't need to do that. But isn't it great to know you could?

sheet.js's People

Contributors

subtlegradient avatar nv avatar

Watchers

 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.