JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 143465
  • Score
    100M100P100Q161934F

Nested selectors plugin for jss

Package Exports

  • jss-nested

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jss-nested) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Nested selectors plugin for JSS

This plugin implements nested selectors for jss.

Take a look at examples directory.

Put an & before a selector within a rule and it will be replaced by the parent selector and extracted to a separate rule.

{
    '.container': {
        padding: '20px',
        // Will result in .container.clear
        '&.clear': {
            clear: 'both'
        },
        // Will result in .container .button
        '& .button': {
            background: 'red'
        },
        '&.selected, &.active': {
            border: '1px solid red'
        },
        '&:hover': {
            background: 'blue'
        }
    }
}
.container {
    padding: 20px;
}
.container.clear {
    clear: both;
}
.container .button {
    background: red;
}
.container.selected, .container.active {
    border: 1px solid red;
}

Register plugin

var jss = require('jss')
var nested = require('jss-nested')
jss.use(nested)

Run tests

Locally

npm i
open test/local.html

From github

Tests

License

MIT