fffunction / node-sass-globbing

Extension for gulp-sass and node-sass to allow you to do import "dir/**/*.sass" or "dir/**/*.scss". Inspired by https://github.com/chriseppstein/sass-globbing and forked from https://github.com/britco/node-sass-globbing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

node-sass-globbing

Build Status Dependency Status npm

Allows you to use glob syntax in imports (i.e. @import "dir/*.sass"). Use as a custom importer for node-sass.

Example

gulpfile.js
var nodeSassGlobbing = require('node-sass-globbing');

gulp.task('sass', function () {
	return gulp.src('styles/**/*.{scss,sass}')
			.pipe(sass({importer: nodeSassGlobbing}).on('error', sass.logError)))
			.pipe(gulp.dest('css'))			
}));
	

Then you can import globs!

foo.sass
@import "variables/**/*.scss";
@import "mixins/**/*.scss";

It also works with sourcemaps:

var nodeSassGlobbing = require('node-sass-globbing'),
	sourcemaps = require('gulp-sourcemaps');

gulp.task('sass', function () {
	return gulp.src('styles/**/*.{scss,sass}')
			.pipe(sourcemaps.init())
			.pipe(sass({importer: nodeSassGlobbing}).on('error', sass.logError)))
			.pipe(sourcemaps.write('./maps'))
			.pipe(gulp.dest('css'))			
}));

Tests

npm test

Tests (Docker)

You can also run the tests through docker. Initially the repository would need to install the dependencies, you can do that with:

docker run -it --rm --name my-running-script -v "$PWD":/usr/src/app -w /usr/src/app node:4 npm install

After dependencies are installed run the tests with:

docker run -it --rm --name my-running-script -v "$PWD":/usr/src/app -w /usr/src/app node:4 npm test

License

Available under the MIT License.

About

Extension for gulp-sass and node-sass to allow you to do import "dir/**/*.sass" or "dir/**/*.scss". Inspired by https://github.com/chriseppstein/sass-globbing and forked from https://github.com/britco/node-sass-globbing

License:MIT License


Languages

Language:JavaScript 100.0%