Sheetify is a modular CSS bundler designed primarily for use with Browserify. It allows developers to import and namespace CSS directly within JavaScript files, treating CSS as a first-class module similar to how JavaScript modules are handled via npm. The current stable version is 8.0.0. While not following a strict frequent release cadence, it receives updates for dependency maintenance and feature enhancements. Key differentiators include its ability to automatically namespace CSS classes based on content hashes, eliminating the need for complex BEM-like naming schemes, and its extensibility through transforms. It enables importing CSS packages from npm, inlining CSS directly into views for transparency, and offers a minimal API surface. It specifically targets client-side bundling workflows where Browserify is the primary tool for module resolution and bundling.
npm install sheetifyVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to use `sheetify` with Browserify to namespace inline CSS defined using tagged template literals and append the resulting HTML to the document body, including setup instructions.
Upgrade your Node.js environment to version 6 or higher. Consider using a Node.js version manager like `nvm` to manage multiple Node.js installations.
For external CSS that needs namespacing, consider wrapping its content within a tagged template literal or using a custom transform that applies namespacing logic.
For dynamic styling, you must use inline styles on the HTML elements or manipulate CSS properties directly via JavaScript after the initial render.
Ensure `sheetify` is installed: `npm install sheetify --save-dev`. Verify your `browserify` command includes `-t sheetify` and that `index.js` correctly `require`s `sheetify`.
Sheetify is a CommonJS module. Use `const css = require('sheetify')` instead of `import`. If targeting modern Node.js or browser ESM, ensure your build setup correctly transforms CommonJS `require` to ES `import` for dependencies.