rework-visit is a utility package providing a declaration visitor for the Rework CSS preprocessor's Abstract Syntax Tree (AST). Released as version 1.0.0 in June 2013, it has not seen active development or new releases since. The package enables Rework plugins to traverse and manipulate CSS declarations programmatically within the AST. It is specifically designed for the `rework` ecosystem, which has largely been superseded by more modern and actively maintained CSS tooling like PostCSS. Therefore, rework-visit is considered abandoned, with no ongoing release cadence or new feature development. Its core differentiator is its tight integration with the now-legacy Rework AST, making it unsuitable for contemporary CSS processing pipelines.
npm install rework-visitVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to use `rework-visit` within a `rework` plugin to iterate over and modify CSS declarations in an AST. It changes 'font-size' and adds 'align-items' to flex containers.
Migrate your CSS processing pipeline to PostCSS or a modern alternative. Existing `rework` plugins using `rework-visit` will likely need to be rewritten for the new tooling.
Ensure your project uses CommonJS `require()` statements for `rework-visit`. If your project is ESM-first, you might need to use dynamic `import()` or stick to CommonJS for the parts interacting with `rework-visit`.
Avoid using `rework-visit` for projects requiring modern CSS syntax. Use tools that actively support the latest CSS specifications.
This package is CommonJS. If you are in an ESM module, you cannot directly use `require()`. You must either convert your file to CommonJS (`.cjs` or `"type": "commonjs"` in `package.json`) or use a dynamic import, e.g., `const visit = await import('rework-visit');` (note: this will still return a module object, not the direct function, so you might need `(await import('rework-visit')).default`).This error indicates that the CSS input contains syntax (e.g., nesting, custom properties advanced usage, new selectors) that the outdated `rework` parser cannot handle. `rework-visit` is not compatible with modern CSS. Consider using PostCSS with appropriate plugins for contemporary CSS processing.