{"library":"node-sass-glob-importer","title":"Node-Sass Glob Importer","description":"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.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install node-sass-glob-importer"],"cli":null},"imports":["import { globImporter } from 'node-sass-glob-importer';","const { globImporter } = require('node-sass-glob-importer');","import type { GlobImporterOptions } from 'node-sass-glob-importer';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"/* webpack.config.js */\nconst { globImporter } = require('node-sass-glob-importer');\nconst MiniCssExtractPlugin = require('mini-css-extract-plugin');\n\n// Ensure you have `node-sass`, `sass-loader`, `mini-css-extract-plugin`, and `webpack` installed.\n// npm install --save-dev node-sass sass-loader mini-css-extract-plugin webpack webpack-cli\n\nmodule.exports = {\n  entry: './src/index.scss',\n  output: {\n    filename: 'bundle.js',\n    path: require('path').resolve(__dirname, 'dist'),\n  },\n  module: {\n    rules: [\n      {\n        test: /\\.scss$/,\n        use: [\n          MiniCssExtractPlugin.loader,\n          'css-loader',\n          {\n            loader: 'sass-loader',\n            options: {\n              sassOptions: {\n                importer: globImporter() // Use the glob importer here\n              }\n            }\n          }\n        ]\n      }\n    ]\n  },\n  plugins: [\n    new MiniCssExtractPlugin({\n      filename: 'style.css'\n    })\n  ]\n};\n\n/* src/index.scss */\n@import 'styles/**/*.scss'; /* Example glob import */\n\n/* src/styles/_base.scss */\nbody { font-family: sans-serif; }\n\n/* src/styles/_vars.scss */\n$primary-color: blue;\n","lang":"typescript","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}