Plugin framework for CSS preprocessing
npm install reworkCSS manipulations built on css, allowing
you to automate vendor prefixing, create your own properties, inline images,
anything you can imagine!
Please refer to css for AST documentation
and to report parser/stringifier issues.
$ npm install rework
``js
var rework = require('rework');
var pluginA = require('pluginA');
var pluginB = require('pluginB');
rework('body { font-size: 12px; }', { source: 'source.css' })
.use(pluginA)
.use(pluginB)
.toString({ sourcemap: true })
`
Accepts a CSS string and returns a new Rework instance. The options arecss.parse
passed directly to .
Use the given plugin fn. A rework "plugin" is simply a function accepting theRework
stylesheet root node and the instance.
Returns the string representation of the manipulated CSS. The options arecss.stringify
passed directly to .
Unlike css.stringify, if you pass sourcemap: true a string will still besourcemapAsObject: true
returned, with the source map inlined. Also use ifcss.stringify
you want the return value.
Rework has a rich collection of plugins and mixins. Browse all the Rework
plugins available on npm.
Plugins of particular note:
- at2x – serve high resolution images
- calc – resolve simple calc() expressionsrgba(#fc0, .5)
- colors – color helpers like extend: selector
- ease – several additional easing functions
- extend – support@import
- function – user-defined CSS functions
- import – read and inline CSS via @import
- inline – inline assets as data URIs
- mixin – custom property logic with mixins
- npm - inline CSS via using node's module resolverheight: @width
- references – property references like url()`s with a given function
- url – rewrite
- variables – W3C-style variables
- styl
- rework-pure-css
- rework-suit
- resin
- Myth
(The MIT License)
Copyright (c) 2012–2013 TJ Holowaychuk
Copyright (c) 2014 Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the 'Software'), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.