https://github.com/nitive/postcss-extract
PostCSS plugin to extract css inside @at-rules into separate files
https://github.com/nitive/postcss-extract
Last synced: over 1 year ago
JSON representation
PostCSS plugin to extract css inside @at-rules into separate files
- Host: GitHub
- URL: https://github.com/nitive/postcss-extract
- Owner: Nitive
- License: mit
- Created: 2016-02-27T08:59:10.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-01-28T18:53:32.000Z (over 9 years ago)
- Last Synced: 2025-03-03T04:17:00.796Z (over 1 year ago)
- Language: JavaScript
- Size: 44.9 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# PostCSS Extract [![Build Status][ci-img]][ci] [![codecov.io][codecov-img]][codecov]
[PostCSS] plugin to extract css inside @at-rules into separate files.
[PostCSS]: https://github.com/postcss/postcss
[ci-img]: https://travis-ci.org/Nitive/postcss-extract.svg
[ci]: https://travis-ci.org/Nitive/postcss-extract
[codecov-img]: https://codecov.io/github/Nitive/postcss-extract/coverage.svg?branch=master
[codecov]: https://codecov.io/github/Nitive/postcss-extract?branch=master
```css
.foo {
@critical {
height: 40px;
}
text-decoration: underline;
}
@critical {
.bar {
background-color: tomato;
}
}
```
styles.css
```css
.foo {
text-decoration: underline;
}
```
extracted.css
```css
.foo {
height: 40px;
}
.bar {
background-color: tomato;
}
```
## Usage
```js
postcss([
require('postcss-extract')({
extract: {
// keys are @at-rules, values are files to extract @at-rules content
critical: path.join(__dirname, './relative/path/to/file.css')
}
})
])
```
See [PostCSS] docs for examples for your environment.
## [License](/LICENSE)
MIT © [Maxim Samoilov](http://twitter.com/_nitive)