sass-glob-importer

Import Sass files from NPM and Bower Modules

Usage no npm install needed!

<script type="module">
  import sassGlobImporter from 'https://cdn.skypack.dev/sass-glob-importer';
</script>

README

sass-glob-importer

Simple importer for node-sass to allow importing Sass files using glob patterns

@import "settings/*.scss";
@import "components/*.scss";

The files will always be sorted alphabetically when imported.

How-to

install

npm install sass-glob-importer --save-dev

use the importer with node-sass >= v3.0.0

var sass = require('node-sass');
var globImporter = require('sass-glob-importer');

sass.render({
  file: './source/css/app.scss',
  importer: globImporter()
}, cb);

use the importer with gulp-sass

var gulp = require('gulp');
var sass = require('gulp-sass');
var globImporter = require('sass-glob-importer');

gulp.task('style', function() {
  return gulp.src('./source/css/app.scss')
    .pipe(sass({ importer: globImporter() }))
    .pipe(gulp.dest('./public/css'));
});

Tests

Use npm test to run the tests.

Issues

If you discover a bug, please raise an issue on Github. https://github.com/lucasmotta/sass-glob-importer/issues

Contributors

The source code and the test are written in ES6 (ECMAScript 2015).
Babel is being used to compile to ES5 before the package is published to npm.