modern-sass-glob-importer
v1.0.0
Published
Sass importer for resolving glob patterns compatible with the modern Sass JS API
Readme
Modern Sass Glob Importer
A custom importer for Sass that expands glob patterns.
@use "components/**/*.scss";
@use "elements/**/*.scss";Description
While there are a number of Sass glob importers available, none of them currently work with the modern JS API or support @use statements. This importer only works with the modern API and has no intention of working with the legacy API.
Features
- Expands
*.globpatterns to their matching files - Imports from both
@useand@importstatements - Supports nested imports
- Works with vite, webpack, etc, or standalone
Installation
npm install modern-sass-glob-importerUsage
const sass = require("sass");
const globImporter = require("modern-sass-glob-importer");
// Standalone usage
sass
.compile("path/to/style.scss", {
importers: [globImporter()],
})
.then(function (result) { });Example
@use "components/*.scss";
@use "elements/*.scss";License
MIT
