Created
August 20, 2016 01:56
-
-
Save SergProduction/7226983e737ff5416dedd3c0cd369133 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const gulp = require('gulp'); | |
const babel = require('gulp-babel'); | |
const sourcemaps = require('gulp-sourcemaps'); | |
const gutil = require('gulp-util'); | |
const clean = require('gulp-clean'); | |
const concat = require('gulp-concat'); | |
const uglify = require('gulp-uglify'); | |
const rename = require('gulp-rename'); | |
const filesize = require('gulp-filesize'); | |
const stylus = require('gulp-stylus'); | |
const less = require('gulp-less'); | |
const changed = require('gulp-changed'); | |
const watch = require('gulp-watch'); | |
gulp.task('clean', function () { | |
return gulp.src('build', {read: false}) | |
.pipe(clean()); | |
}); | |
gulp.task('js', function() { | |
return gulp.src('js/*.js') | |
.pipe(sourcemaps.init()) | |
.pipe(babel({ | |
presets: ['es2015'] | |
})) | |
.pipe(concat('compile.js')) | |
.pipe(gulp.dest('public/js')) | |
.pipe(filesize()) | |
.pipe(uglify()) | |
.pipe(rename('compile.min.js')) | |
.pipe(sourcemaps.write('.')) | |
.pipe(gulp.dest('public/js')) | |
.pipe(filesize()) | |
.on('error', gutil.log) | |
}); | |
gulp.task('css', function () { | |
return gulp.src('less/*.less') | |
.pipe(changed('public/css')) | |
.pipe(less({ | |
paths: [ path.join(__dirname, 'less', 'includes') ] | |
})) | |
.pipe(gulp.dest('public/css')) | |
.on('error', gutil.log); | |
}); | |
gulp.task('css:watch', function () { | |
watch({ | |
glob: 'less/*.less', | |
emit: 'one', | |
emitOnGlob: false | |
}, function(files) { | |
return files | |
.pipe(less({ | |
paths: [ path.join(__dirname, 'less', 'includes') ] | |
})) | |
.pipe(gulp.dest('build/css')) | |
.on('error', gutil.log); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment