Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jss-extend

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jss-extend

JSS plugin that enables inheritance

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
65K
increased by20.18%
Maintainers
1
Weekly downloads
 
Created
Source

JSS logo

JSS plugin that enables inheritance

This plugin implements a custom extend style property.

Demo - JSS

![Gitter](https://badges.gitter.im/Join Chat.svg)

Usage example

import jss from 'jss'
import extend from 'jss-extend'

jss.use(extend)

const redContainer = {
  background: 'red'
}

const styleSheet = jss.createStyleSheet({
  container: {
    extend: redContainer, // Can be an array of styles
    'font-size': '20px'
  }
})

/**
 * For those who use an ES6 transpiler - you can achieve the same
 * by using the language itself.
 */

// ES7
const styleSheet = jss.createStyleSheet({
  container: {
    ...redContainer,
    'font-size': '20px'
  }
})

// ES6
const styleSheet = jss.createStyleSheet({
  container: Object.assign({}, redContainer, {
    'font-size': '20px'
  })
})

// Or with a helper
import xtend from 'xtend' // Does not mutate arguments

const styleSheet = jss.createStyleSheet({
  container: xtend(redContainer, {
    'font-size': '20px'
  })
})
console.log(styleSheet.toString())
.jss-0-0 {
  background: red;
  font-size: 20px;
}
console.log(styleSheet.classes)
{ container: "jss-0-0" }

Run tests

npm i
npm run test

License

MIT

Keywords

FAQs

Package last updated on 21 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc