rework
CSS manipulations built on CSSOM
Last updated 12 years ago by tjholowaychuk .
Repository · Original npm · Tarball · package.json
$ npm install rework 
SYNC missed versions from official npm registry.

rework Build Status

CSS 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.

Installation

$ npm install rework

Usage

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 })

API

rework(code, [options])

Accepts a CSS string and returns a new Rework instance. The options are passed directly to css.parse.

Rework#use(fn)

Use the given plugin fn. A rework "plugin" is simply a function accepting the stylesheet root node and the Rework instance.

Rework#toString([options])

Returns the string representation of the manipulated CSS. The options are passed directly to css.stringify.

Unlike css.stringify, if you pass sourcemap: true a string will still be returned, with the source map inlined. Also use sourcemapAsObject: true if you want the css.stringify return value.

Plugins

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() expressions
  • colors – color helpers like rgba(#fc0, .5)
  • ease – several additional easing functions
  • extendextend: selector support
  • 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 @import using node's module resolver
  • references – property references like height: @width
  • url – rewrite url()s with a given function
  • variables – W3C-style variables

Built with rework

License

(The MIT License)

Copyright (c) 2012–2013 TJ Holowaychuk tj@vision-media.ca

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.

Current Tags

  • 1.0.1                                ...           latest (10 years ago)

45 Versions

  • 1.0.1                                ...           10 years ago
  • 1.0.0                                ...           11 years ago
  • 0.20.3                                ...           11 years ago
  • 0.20.2                                ...           11 years ago
  • 0.20.1                                ...           11 years ago
  • 0.20.0 [deprecated]           ...           11 years ago
  • 0.19.0                                ...           11 years ago
  • 0.18.3                                ...           11 years ago
  • 0.18.2                                ...           11 years ago
  • 0.18.1                                ...           11 years ago
  • 0.18.0                                ...           11 years ago
  • 0.17.4                                ...           11 years ago
  • 0.17.3                                ...           11 years ago
  • 0.17.2                                ...           11 years ago
  • 0.17.1                                ...           11 years ago
  • 0.17.0                                ...           12 years ago
  • 0.16.0                                ...           12 years ago
  • 0.15.0                                ...           12 years ago
  • 0.14.0                                ...           12 years ago
  • 0.13.2                                ...           12 years ago
  • 0.13.1                                ...           12 years ago
  • 0.13.0                                ...           12 years ago
  • 0.12.2                                ...           12 years ago
  • 0.12.1                                ...           12 years ago
  • 0.12.0                                ...           12 years ago
  • 0.11.0                                ...           12 years ago
  • 0.10.2                                ...           12 years ago
  • 0.10.1                                ...           12 years ago
  • 0.10.0                                ...           12 years ago
  • 0.9.2                                ...           12 years ago
  • 0.9.1                                ...           12 years ago
  • 0.9.0                                ...           12 years ago
  • 0.8.0                                ...           12 years ago
  • 0.7.0                                ...           12 years ago
  • 0.6.1                                ...           12 years ago
  • 0.6.0                                ...           12 years ago
  • 0.5.1                                ...           12 years ago
  • 0.5.0                                ...           12 years ago
  • 0.4.1                                ...           12 years ago
  • 0.4.0                                ...           12 years ago
  • 0.3.0                                ...           12 years ago
  • 0.1.2                                ...           12 years ago
  • 0.1.1                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
  • 0.0.1                                ...           12 years ago
Maintainers (1)
Downloads
Total 7
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (6)
Dev Dependencies (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE