JSPM

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

JSS plugin that enables inheritance

Package Exports

  • jss-extend

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-extend) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

JSS plugin that enables inheritance

Gitter

This plugin implements a custom extend style property.

Value of extend property can be a string, object and array. If string is used, it will look for a rule with such a name. If object - plain rule object is expected, if array - an array of plain rule objects is expected.

Rule's own properties always take precedence over extended rules, so you can always override the extended definition.

Examples

const styles = {
  redContainer: {
    background: 'red'
  },
  container: {
    extend: 'redContainer',
    'font-size': '20px'
  }
}
const redContainer = {
  background: 'red'
}
const styles = {
  container: {
    extend: redContainer, // Can be an array of styles
    'font-size': '20px'
  }
}

Compiles to:

.jss-23g44j5 {
  background: red;
  font-size: 20px;
}

Demo

Simple demo

Multi objects demo

Issues

File a bug against cssinjs/jss prefixed with [jss-extend].

Run tests

npm i
npm run test

License

MIT