# node-sass-glob-importer

> Custom importer for node-sass which makes it possible to use glob syntax in Sass import statements

Latest version **5.3.3** (published 2023-07-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-sass-glob-importer
pnpm add node-sass-glob-importer
yarn add node-sass-glob-importer
bun add node-sass-glob-importer
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.3.3 |
| Published | 2023-07-02 |
| First published | 2016-07-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=6.11.1 |
| Dependencies | 1 |
| Unpacked size | 6.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 294 |
| Author | Markus Oberlehner |
| Maintainers | maoberlehner |
| Keywords | glob-importer, importer, node-sass, sass |

## Links

- npm: https://www.npmjs.com/package/node-sass-glob-importer
- Repository: https://github.com/maoberlehner/node-sass-magic-importer
- Homepage: https://github.com/maoberlehner/node-sass-magic-importer/tree/master/packages/node-sass-glob-importer
- Issues: https://github.com/maoberlehner/node-sass-magic-importer/issues
- npm.io page: https://npm.io/package/node-sass-glob-importer

## Dependencies (1)

- [node-sass-magic-importer](https://npm.io/package/node-sass-magic-importer.md) ^5.3.3

## Recent versions

- 5.3.3 (latest) — 2023-07-02
- 5.3.2 — 2019-05-30
- 5.3.1 — 2019-03-16
- 5.3.0 — 2018-12-31
- 5.2.0 — 2018-07-15
- 5.1.3 — 2018-05-14
- 5.1.2 — 2018-04-10
- 5.1.1 — 2018-03-17
- 5.1.0 — 2018-01-13
- 5.0.3 — 2017-12-15
- 5.0.2 — 2017-12-09
- 5.0.1 — 2017-12-09
- 5.0.0 — 2017-11-30
- 5.0.0-alpha.17 — 2017-11-05
- 5.0.0-alpha.16 — 2017-10-31
- … 32 more at https://npm.io/package/node-sass-glob-importer/versions

## README

# node-sass-glob-importer

[![Patreon](https://img.shields.io/badge/patreon-donate-blue.svg)](https://www.patreon.com/maoberlehner)
[![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://paypal.me/maoberlehner)
[![Build Status](https://travis-ci.org/maoberlehner/node-sass-magic-importer.svg?branch=master)](https://travis-ci.org/maoberlehner/node-sass-magic-importer)
[![Coverage Status](https://coveralls.io/repos/github/maoberlehner/node-sass-magic-importer/badge.svg?branch=master)](https://coveralls.io/github/maoberlehner/node-sass-magic-importer?branch=master)
[![GitHub stars](https://img.shields.io/github/stars/maoberlehner/node-sass-magic-importer.svg?style=social&label=Star)](https://github.com/maoberlehner/node-sass-magic-importer)

Custom node-sass importer to which allows you to use glob syntax in imports

Globbing allows pattern matching operators to be used to match multiple files at once.

```scss
// Import all files inside the `scss` directory and subdirectories.
@import: 'scss/**/*.scss';
```

## Usage

```js
const sass = require('node-sass');
const globImporter = require('node-sass-glob-importer');

sass.render({
  ...
  importer: globImporter()
  ...
});
```

### webpack

```js
// webpack.config.js
const globImporter = require('node-sass-glob-importer');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');

module.exports = {
  module: {
    rules: [
      {
        test: /\.scss$/,
        use: [
          {
            loader: MiniCssExtractPlugin.loader,
          },
          {
            loader: 'css-loader'
          }, {
            loader: 'sass-loader',
            options: {
              sassOptions: {
                importer: globImporter()
              }
            }
          }
        ]
      }
    ]
  },
  plugins: [
    new MiniCssExtractPlugin({
      filename: 'style.css'
    })
  ]
}
```

### CLI

```bash
node-sass --importer node_modules/node-sass-glob-importer/dist/cli.js -o dist src/index.scss
```

## Upgrade from 3.x.x to 5.x.x

It is not possible anymore to set the `includePaths` option when initializing the importer. Use the [node-sass includePaths option](https://github.com/sass/node-sass#includepaths) instead.

## Why is there no 4.x version?

This module is maintained in [one repository](https://github.com/maoberlehner/node-sass-magic-importer) together with multiple other node-sass custom importers. The node-sass-magic-importer repository is using a [monorepo approach](https://medium.com/@maoberlehner/monorepos-in-the-wild-33c6eb246cb9) with fixed versions for all packages. The projects maintained in the node-sass-magic-importer monorepo started out as separate repositories with separate versioning, so when they were integrated into the monorepo, the versions of all projects were raised to 5.0.0 and are in sync since then.

## node-sass-magic-importer

This module is powered by [node-sass-magic-importer](https://github.com/maoberlehner/node-sass-magic-importer).

## About

### Author

Markus Oberlehner  
Website: https://markus.oberlehner.net  
Twitter: https://twitter.com/MaOberlehner  
PayPal.me: https://paypal.me/maoberlehner  
Patreon: https://www.patreon.com/maoberlehner

### License

MIT

---
_Source: https://npm.io/package/node-sass-glob-importer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
