Registry / devops / rework

rework

JSON →
library0.17.2jsnpmunverified

Rework is a plugin framework for CSS preprocessing in Node.js, built upon the `css` package for AST manipulation. It enables developers to create custom CSS transformations, such as automating vendor prefixing, defining custom properties, or inlining images. At version 1.0.1, it provides a simple API (`rework().use(plugin).toString()`) to apply a chain of plugins to a CSS string. The project saw active development around 2012-2014, with its last npm publish over 10 years ago, indicating it is no longer actively maintained. While it offered a robust plugin ecosystem in its time, its stable version is 1.0.1 and it does not follow a current release cadence. Key differentiators at its peak included a straightforward API for AST access and a rich set of community-contributed plugins, predating and offering an alternative to modern PostCSS.

npm install rework
INSTALL
IMPORT
SIG · REWORK
R
rework
devopsjavascriptv0.17.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

rework
const rework = require('rework');
import rework from 'rework';
Rework is a CommonJS module and does not support ES modules directly. Use `require()` for importing.
Rework#use
rework(cssString).use(pluginFn);
rework.use(pluginFn);
The `use` method is called on an instance returned by the `rework()` factory function, not on the `rework` module itself.
Rework#toString
rework(cssString).use(pluginFn).toString({ sourcemap: true });
rework(cssString).toString({ sourcemapAsObject: true });
When `sourcemap: true` is passed, a string with an inlined source map is returned. To get the source map as a separate object, `sourcemapAsObject: true` must be used.

Demonstrates applying a simple Rework plugin to add a vendor prefix and generates an inline source map.

const rework = require('rework'); // A dummy plugin that adds a vendor prefix to `box-sizing` function addPrefixPlugin(stylesheet, reworkInstance) { stylesheet.rules.forEach(rule => { if (rule.type === 'rule' && rule.declarations) { rule.declarations.forEach(declaration => { if (declaration.property === 'box-sizing') { rule.declarations.unshift({ type: 'declaration', property: '-webkit-box-sizing', value: declaration.value }); } }); } }); } const cssInput = 'body { font-size: 12px; box-sizing: border-box; }'; const processedCss = rework(cssInput, { source: 'source.css' }) .use(addPrefixPlugin) .toString({ sourcemap: true }); console.log(processedCss); /* Expected output: body { font-size: 12px; -webkit-box-sizing: border-box; box-sizing: border-box; } /*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNvdXJjZS5jc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsSUFBSSxZQUFZLFNBQVMsa0NBQWtCLENBQUMiLCJmaWxlIjoiZ2VuZXJhdGVkLmNzcyIsInNvdXJjZXNDb250ZW50cyI6WyJib2R5IHsgZm9udC1zaXplOiAxMnB4OyBib3gtc2l6aW5nOiBib3JkZXItYm94OyB9Il19 *//* */
Debug
Known issues
breakingThe Rework project is officially abandoned and has not seen updates for over 10 years (last publish 1.0.1 over a decade ago). It is not compatible with modern JavaScript module systems (ESM) or recent CSS specifications and may contain unaddressed security vulnerabilities.
fix
Migrate to a currently maintained CSS preprocessor or postprocessor, such as PostCSS with relevant plugins, which offers similar AST manipulation capabilities and active development.
affects: >=1.0.1
gotchaRework relies on an extremely old version of its core `css` parser/stringifier. This means it may fail to parse or incorrectly stringify modern CSS syntax (e.g., CSS Custom Properties, `gap` property in flexbox/grid, `@container` queries, `@layer` rules, etc.).
fix
For projects requiring modern CSS support, switching to a current tool like PostCSS is essential. Attempting to use Rework with contemporary CSS is likely to cause parsing errors or unexpected output.
affects: >=1.0.1
gotchaRework is a CommonJS-only module. Attempting to `import` it in an ES module environment will result in errors.
fix
In ES module projects, you must use dynamic `import()` or wrap `require()` with a compatibility layer, or preferably, use a modern alternative that supports ESM natively.
affects: >=1.0.1
gotchaMany of Rework's ecosystem plugins (e.g., `rework-npm`, `rework-import`, `rework-vars`) are also abandoned and have not been updated in many years, making the entire ecosystem potentially unstable and incompatible with current web development practices.
fix
Before adopting any Rework plugin, verify its maintenance status and compatibility. For new projects, assume no plugin is actively maintained and seek modern alternatives.
affects: >=1.0.1
Errors
Common errors & fixes
TypeError: rework is not a function
Attempting to call `rework` as a function when it was incorrectly imported or when `rework` is undefined, often due to an invalid CommonJS `require` call or mixing with ESM.
fix
Ensure you are using `const rework = require('rework');` in a CommonJS context and that `rework` is correctly resolved by your module loader.
Error: Cannot find module 'css'
The `css` dependency, which is critical for Rework's operation, is not installed or not resolvable in the project.
fix
Run `npm install css` to ensure the core dependency is present. Verify that your `node_modules` are correctly set up and accessible.
Parsing error: Please check the validity of the CSS syntax.
Rework's underlying `css` parser is very old and does not support modern CSS features or may have strict parsing rules that cause it to fail on valid contemporary CSS.
fix
Simplify your CSS to older syntax or, ideally, migrate to a modern CSS processing tool like PostCSS which has up-to-date parser support.
Upgrade
Version history
0.17.2latest on npm
Audit
Dependencies
cssrequiredCore CSS parser and stringifier. Rework relies on its AST for all manipulations. Note that Rework uses a very old version of this dependency, leading to potential issues with modern CSS syntax.
Agent activity
4 hits · last 30 days
node
4
Resources
rework — npm install rework · libregistry