|
@@ -1,13 +1,5 @@
|
|
|
var gulp = require('gulp');
|
|
|
-var gutil = require('gulp-util');
|
|
|
-var coffeelint = require('gulp-coffeelint');
|
|
|
-var coffee = require('gulp-coffee');
|
|
|
-var rename = require('gulp-rename');
|
|
|
-var uglify = require('gulp-uglify');
|
|
|
-var less = require('gulp-less');
|
|
|
-var header = require('gulp-header');
|
|
|
-var clean = require('gulp-clean');
|
|
|
-var open = require('gulp-open');
|
|
|
+var plugins = require("gulp-load-plugins")();
|
|
|
var pkg = require('./package.json');
|
|
|
var name = pkg.name;
|
|
|
var banner = [
|
|
@@ -36,60 +28,58 @@ var banner = [
|
|
|
|
|
|
gulp.task('coffee', function() {
|
|
|
gulp.src('src/coffee/' + name + '.coffee')
|
|
|
- .pipe(coffeelint({
|
|
|
+ .pipe(plugins.coffeelint({
|
|
|
indentation: 2,
|
|
|
no_trailing_semicolons: true,
|
|
|
no_trailing_whitespace: true
|
|
|
}))
|
|
|
- .pipe(coffee()).on('error', gutil.log)
|
|
|
- .pipe(header(banner, { pkg: pkg }))
|
|
|
+ .pipe(plugins.coffee()).on('error', plugins.util.log)
|
|
|
+ .pipe(plugins.header(banner, { pkg: pkg }))
|
|
|
.pipe(gulp.dest('build/js'))
|
|
|
- .pipe(uglify())
|
|
|
- .pipe(header(banner, { pkg: pkg }))
|
|
|
- .pipe(rename({ suffix: '.min' }))
|
|
|
+ .pipe(plugins.uglify())
|
|
|
+ .pipe(plugins.header(banner, { pkg: pkg }))
|
|
|
+ .pipe(plugins.rename({ suffix: '.min' }))
|
|
|
.pipe(gulp.dest('build/js'));
|
|
|
});
|
|
|
|
|
|
gulp.task('less-bootstrap2', function() {
|
|
|
gulp.src('src/less/bootstrap2/build.less')
|
|
|
- .pipe(less())
|
|
|
- .pipe(header(banner, { pkg: pkg }))
|
|
|
- .pipe(rename({ basename: name }))
|
|
|
+ .pipe(plugins.less())
|
|
|
+ .pipe(plugins.header(banner, { pkg: pkg }))
|
|
|
+ .pipe(plugins.rename({ basename: name }))
|
|
|
.pipe(gulp.dest('build/css/bootstrap2'))
|
|
|
- .pipe(less({
|
|
|
+ .pipe(plugins.less({
|
|
|
compress: true,
|
|
|
cleancss: true
|
|
|
}))
|
|
|
- .pipe(header(banner, { pkg: pkg }))
|
|
|
- .pipe(rename({ suffix: '.min' }))
|
|
|
+ .pipe(plugins.header(banner, { pkg: pkg }))
|
|
|
+ .pipe(plugins.rename({ suffix: '.min' }))
|
|
|
.pipe(gulp.dest('build/css/bootstrap2'));
|
|
|
});
|
|
|
|
|
|
gulp.task('less-bootstrap3', function() {
|
|
|
- gulp.src([
|
|
|
- 'src/less/bootstrap3/build.less',
|
|
|
- ])
|
|
|
- .pipe(less())
|
|
|
- .pipe(header(banner, { pkg: pkg }))
|
|
|
- .pipe(rename({ basename: name }))
|
|
|
+ gulp.src('src/less/bootstrap3/build.less')
|
|
|
+ .pipe(plugins.less())
|
|
|
+ .pipe(plugins.header(banner, { pkg: pkg }))
|
|
|
+ .pipe(plugins.rename({ basename: name }))
|
|
|
.pipe(gulp.dest('build/css/bootstrap3'))
|
|
|
- .pipe(less({
|
|
|
+ .pipe(plugins.less({
|
|
|
compress: true,
|
|
|
cleancss: true
|
|
|
}))
|
|
|
- .pipe(header(banner, { pkg: pkg }))
|
|
|
- .pipe(rename({ suffix: '.min' }))
|
|
|
+ .pipe(plugins.header(banner, { pkg: pkg }))
|
|
|
+ .pipe(plugins.rename({ suffix: '.min' }))
|
|
|
.pipe(gulp.dest('build/css/bootstrap3'));
|
|
|
});
|
|
|
|
|
|
gulp.task('clean', function() {
|
|
|
gulp.src(['build/css', 'build/js'], { read: false })
|
|
|
- .pipe(clean());
|
|
|
+ .pipe(plugins.clean());
|
|
|
});
|
|
|
|
|
|
gulp.task('open', function(){
|
|
|
gulp.src('index.html')
|
|
|
- .pipe(open());
|
|
|
+ .pipe(plugins.open());
|
|
|
});
|
|
|
|
|
|
gulp.task('watch', function () {
|
|
@@ -98,4 +88,6 @@ gulp.task('watch', function () {
|
|
|
gulp.watch('src/less/bootstrap3/*.less', ['less-bootstrap3']);
|
|
|
});
|
|
|
|
|
|
-gulp.task('default', ['clean', 'coffee', 'less-bootstrap2', 'less-bootstrap3', 'open', 'watch']);
|
|
|
+gulp.task('default', ['clean'], function() {
|
|
|
+ gulp.start('coffee', 'less-bootstrap2', 'less-bootstrap3', 'open', 'watch')
|
|
|
+});
|