Skip to content
A module for scoping your CSS. No class prefixes. No ids.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
test/specs
.eslintrc
.jscsrc
.min-wd
.nvmrc
.tern-project
README.md
TODO.md
index.js
package.json

README.md

Stylescope

Don't pollute. Scope your styles.

Getting Going

Please see the tests to see what works so far. This is not in a ready state yet. The tested case works, but other things you'll try may not.

const Stylescope       = require('stylescope') 

const el               = document.querySelector('section')
const scopedStyleSheet = Stylescope(el, childSelPropAssoc)

// data-attribute-based selector representing the context
scopedStyleSheet.selector  

// The <style>
scopedStyleSheet.styleEl     

// The CSSStyleSheet
scopedStyleSheet.sheet       

scopedStyleSheet.createRule  
scopedStyleSheet.pushRule    
scopedStyleSheet.pushRules  
scopedStyleSheet.deleteRule
scopedStyleSheet.deleteRules 

// The last set of indexes created
scopedStyleSheet.lastPushedRuleIndexes 

Testing

  • Uses Mochify w/ WebDriver. See the min-webdriver repo for WebDriver config details.
    • Change closeOnSuccess or closeOnFailure to inspect the DOM after tests
  • The Mochify detais are useful as well
You can’t perform that action at this time.