node-sass-glob-importer is a custom importer for node-sass (currently at v5.3.3) that enables the use of glob syntax within Sass `@import` statements. This allows developers to import multiple Sass files using pattern matching, such as `@import 'scss/**/*.scss';`, significantly streamlining stylesheet management in projects with numerous partials. The package is maintained as part of the `node-sass-magic-importer` monorepo, where all included packages, including this one, maintain synchronized versioning (starting from 5.0.0 after integrating into the monorepo). It receives regular maintenance updates, primarily for dependency bumps, bug fixes, and minor feature enhancements. Its key differentiator is simplifying the import process for large Sass projects by aggregating many partials without listing each one individually, leveraging the existing `node-sass` ecosystem for compilation. Users should be aware that `node-sass` itself is a wrapper around the now-deprecated LibSass, and modern Sass development has largely shifted to Dart Sass.
npm install node-sass-glob-importerVerified import paths — ran on the pinned version, not inferred.
This Webpack configuration demonstrates how to integrate `node-sass-glob-importer` with `sass-loader` and `MiniCssExtractPlugin` to enable glob imports in your Sass files within a Webpack build pipeline.
Migrate `includePaths` configuration from `importer: globImporter({ includePaths: [...] })` to `sassOptions: { includePaths: [...] }` within your `node-sass` or `sass-loader` setup.For new projects, consider using Dart Sass (`sass` package) with its own globbing solutions if available, or evaluate the long-term implications of relying on the `node-sass` ecosystem.
Be aware that version 4.x.x does not exist for this package. Consult the release notes for version 5.0.0 and subsequent releases for all breaking changes and new features when upgrading from 3.x.x.
Move the `includePaths` option to the `sassOptions` object provided to `node-sass` or `sass-loader`.
Double-check your glob patterns, ensure the paths are correct relative to the importing file, and verify that files matching the pattern actually exist. Ensure `node-sass-glob-importer` is correctly configured in your build process.
For ESM, use `import { globImporter } from 'node-sass-glob-importer';`. For CommonJS, use `const { globImporter } = require('node-sass-glob-importer');`.