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 reworkVerified import paths — ran on the pinned version, not inferred.
Demonstrates applying a simple Rework plugin to add a vendor prefix and generates an inline source map.
Migrate to a currently maintained CSS preprocessor or postprocessor, such as PostCSS with relevant plugins, which offers similar AST manipulation capabilities and active development.
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.
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.
Before adopting any Rework plugin, verify its maintenance status and compatibility. For new projects, assume no plugin is actively maintained and seek modern alternatives.
Ensure you are using `const rework = require('rework');` in a CommonJS context and that `rework` is correctly resolved by your module loader.Run `npm install css` to ensure the core dependency is present. Verify that your `node_modules` are correctly set up and accessible.
Simplify your CSS to older syntax or, ideally, migrate to a modern CSS processing tool like PostCSS which has up-to-date parser support.