1.6.3 • Published 4 years ago

stylesheet-decorator v1.6.3

Weekly downloads
30
License
MIT
Repository
github
Last release
4 years ago

This decorator allows to easily style Preact/React (since 1.6.*) components through adding a scoped stylesheet inside that component and defined styles only get applied to it and its descendants.

Basically it allows to style preact/react like Angular or Vue does by adding a scoped stylesheet

Demo (Preact)

Edit z3p207zxml

Getting started

install npm install stylesheet-decorator --save

usage:

  1. import
import { stylesheet } from "stylesheet-decorator[/preact]"
import { stylesheet } from "stylesheet-decorator/react"
  1. define a string with raw CSS content
const style = `
  span { font-size: 20px; color: lightblue; }
`
  1. Plug it on render fn of some Preact/React component
@stylesheet(style)
render() {
  return <span>something</span>
}

or

stylesheet(style, props => <span>something</span>)

That's all.

This decorator supports all CSS capabilities defined here: https://www.npmjs.com/package/scope-css

This development is related on this conversation: Twitter Link and this issue GH preact issue

1.6.3

4 years ago

1.6.2

6 years ago

1.6.1

6 years ago

1.6.0

6 years ago

1.5.0

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.0

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago