Customizr is a build tool designed to optimize Modernizr installations by automatically detecting used feature tests within a project's JavaScript and (S)CSS files and generating a custom, minified Modernizr bundle. It helps developers create lean, performant websites by eliminating unused Modernizr tests, thereby reducing asset size and improving load times. The current stable version is 3.0.5, with recent minor updates indicating active maintenance and compatibility with modern Node.js environments. It operates primarily as a command-line interface tool, offering extensive configuration options via a JSON file. Key differentiators include its intelligent crawling capabilities for automated test detection, a high degree of configurability, and seamless integration with popular build systems like Grunt and Gulp through dedicated wrapper packages. This streamlines the Modernizr optimization process, ensuring only the necessary feature detections are included in the final build.
npm install customizrVerified import paths — ran on the pinned version, not inferred.
Demonstrates creating a configuration file for Customizr and then running it via the command line interface to generate a custom Modernizr build based on detected features in source files.
Upgrade your Node.js installation to version 18 or newer using a version manager like nvm (e.g., `nvm install 18 && nvm use 18`).
Use Modernizr's generated CSS classes (e.g., `.flexbox`, `.no-flexbox`) in your stylesheets to correctly trigger detection by Customizr's crawler.
Set the `devFile` option in your configuration to the path of your development Modernizr file, or ensure `crawl` is set to `false` if you are manually defining `tests`.
Add the specific test name to the `excludeTests` array in your configuration to explicitly ignore it during the crawling process.
To force a rebuild and ignore the cache, use the `--force` command-line option (`npx customizr -c customizr.config.json --force`) or set `cache: false` in your config temporarily.
Ensure the path provided with the `-c` or `--config` flag is correct and the file exists, e.g., `npx customizr -c ./customizr.config.json`.
Include the custom-built Modernizr JavaScript file in your HTML using a `<script>` tag, ensuring it loads before any scripts that depend on the `Modernizr` global object.
Update your Node.js environment to version 18 or newer. Tools like `nvm` (Node Version Manager) can help switch versions easily: `nvm install 18 && nvm use 18`.
Provide a path to your development Modernizr file in the `devFile` option within your configuration (e.g., `"devFile": "./node_modules/modernizr/modernizr.js"`), or set `crawl: false` if you intend to manually specify all `tests`.
No dependency data recorded yet.