gulp-wt
Compile Sass to CSS with gulp!
gulp-wt
has dependencies on wellington. This is provided by wellington-bin
.
Please refer the user guide
Install with npm
$ npm install gulp-wt
set your project path.
var wt = require('gulp-wt'),
path = require('path');
gulp.task('wt', function() {
gulp.src('./src/*.scss')
.pipe(wt({
project: path.join(__dirname, 'assets'),
css: 'css',
sass: 'sass'
}))
.pipe(gulp.dest('app/assets/temp'));
});
set your wt settings.
var wt = require('gulp-wt'),
minifyCSS = require('gulp-minify-css');
gulp.task('wt', function() {
gulp.src('./src/*.scss')
.pipe(wt({
css: 'app/assets/css',
sass: 'app/assets/sass',
image: 'app/assets/images'
}))
.pipe(minifyCSS())
.pipe(gulp.dest('app/assets/temp'));
});
Support multiple require option
var wt = require('gulp-wt'),
minifyCSS = require('gulp-minify-css');
gulp.task('wt', function() {
gulp.src('./src/*.scss')
.pipe(wt({
css: 'app/assets/css',
sass: 'app/assets/sass',
image: 'app/assets/images',
require: ['susy', 'modular-scale']
}))
.pipe(minifyCSS())
.pipe(gulp.dest('app/assets/temp'));
});
Support return the output of the Wt as the callback
var wt = require('gulp-wt'),
minifyCSS = require('gulp-minify-css');
gulp.task('wt', function() {
gulp.src('./src/*.scss')
.pipe(wt({
css: 'app/assets/css',
sass: 'app/assets/sass',
image: 'app/assets/images'
}))
.on('error', function(error) {
// Would like to catch the error here
console.log(error);
this.emit('end');
})
.pipe(minifyCSS())
.pipe(gulp.dest('app/assets/temp'));
});
gulp-wt
with gulp-plumber
var wt = require('gulp-wt'),
plumber = require('gulp-plumber'),
minifyCSS = require('gulp-minify-css');
gulp.task('wt', function() {
gulp.src('./src/*.scss')
.pipe(plumber({
errorHandler: function (error) {
console.log(error.message);
this.emit('end');
}}))
.pipe(wt({
css: 'app/assets/css',
sass: 'app/assets/sass',
image: 'app/assets/images'
}))
.on('error', function(err) {
// Would like to catch the error here
})
.pipe(minifyCSS())
.pipe(gulp.dest('app/assets/temp'));
});
default: nested
description: The output style for the compiled css. One of: nested, expanded, compact, or compressed.
default: false
description: Show line comments or not.
default: true
description: Are assets relative.
default: css
description: The target directory where you keep your css stylesheets. It is relative to the project
option.
default: sass
description: The source directory where you keep your sass stylesheets. It is relative to the project
option.
default: js
description: The directory where you keep your javascripts. It is relative to the project
option.
default: font
description: The directory where you keep your fonts. It is relative to the project
option.
default: your project base
description: The location where all your assets are store.
default: true
description: show/hide compile log message.
default: false
format: string
or array
description: The directory where you keep external Wt plugins or extensions that you would like to make available using the @import
function. Common use case would be setting this to your bower_components
directory for example. It is relative to the project
option.
default: false
format: string
or array
description: Require the given Ruby library before running commands. This is used to access Wt plugins without having a project configuration file.
default: false
description: Load all the frameworks or extensions found in the FRAMEWORKS_DIR directory.
default: false
description: Generate standard JSON source maps.
PS. Past wt versions (prior to 1.0.0) do not support --sourcemap
flag, please update sass and wt as the following version.
* sass (3.3.3)
* wt (1.0.2)
default: false
description: Display compilation times.
default: false
description: Turns on sass's debuging information.
description: The environment mode can also be development
or production
.
default: false
description: Set this to the root of your project when deployed.
default: false
description: GENERATED_IMAGES_PATH. Support --generated-images-path
parameter.
default: compile
description: Support wt primary commands: compile or watch.
$ npm i
$ npm test