gulp-sass-dynamic-importer
v0.0.4
Published
Missing dependency resolution helper for gulp-sass
Downloads
4
Readme
gulp-sass-dynamic-importer
Missing dependency resolution helper for gulp-sass
Features
- Parses @imports to prepare dependency graph
- Supports endless stream (watch)
- Dynamically changes dependency tree
Installation
npm install --save gulp-sass-dynamic-importer
Usage
gulp = require 'gulp'
$ = require('gulp-load-plugins')()
CSS_DIR = 'dest/styles'
SASS_DIR = 'src/styles'
SASS_CACHE = '.sass-cache'
gulp.task 'build:sass', (done) ->
cache = new $.fileCache(SASS_CACHE)
gulp.src 'src/styles/**/*.scss'
.pipe cache.filter()
.pipe cache.cache()
.pipe $.sassDynamicImporter(dir: SASS_DIR)
.pipe $.sass()
.on 'error', $.sass.logError
.pipe gulp.dest CSS_DIR
gulp.task 'watch:sass', ->
$.watch 'src/styles/**/*.scss'
.pipe $.sassDynamicImporter(dir: SASS_DIR, endless: true)
.pipe $.sass()
.pipe gulp.dest CSS_DIR
Options
|name|type|description| |----|----|-----------| |dir|string or string[]|Locations to consider while resolving @import paths| |endless|boolean|By default we prevent pushing the same file twice. Set value to true to support endless stream| |logLevel|string|Allows setting more verbose logging|