Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/doxiaodong/react-scoped


https://github.com/doxiaodong/react-scoped

css less react react-scoped scoped scss shadow style stylus

Last synced: 2 months ago
JSON representation

Awesome Lists containing this project

README

        

## ReactScoped
Inspired by angular style scoped

## Usage

npm i react-scoped

```
import { ReactScoped, ViewEncapsulation } from 'react-scoped'

const styles = `
.test {
color: red;
}
.home {
font-size: 20px;
}
`

export default class App extends Component {
render() {
return (


Home





)
}
}
```

## Less

* Webpack: raw-loader!less-loader

* Component

```
import { ReactScoped, ViewEncapsulation } from 'react-scoped'
import styles from './style.less'

export default class App extends Component {
render() {
return (


Home





)
}
}
```

## ReactScoped

```
props: {
styles?: string[]
encapsulation?: ViewEncapsulation
}

defaultProps: {
styles: [],
encapsulation: ViewEncapsulation.Emulated
}
```

## ViewEncapsulation

* As angular ViewEncapsulation (https://angular.io/api/core/ViewEncapsulation)