-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·46 lines (40 loc) · 1.08 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
var gulp = require('gulp');
var sass = require('gulp-sass');
var minify = require('gulp-clean-css');
var plugins = require("gulp-load-plugins")({
pattern: ['gulp-*', 'gulp.*'],
replaceString: /\bgulp[\-.]/
});
var input = './css/**/*.scss';
var output = './css/';
var jsinput = './js/vendor/*.js';
var jsoutput = './js/';
gulp.task('styles', function() {
return gulp.src(input)
// Error reporting
.pipe(sass().on('error', sass.logError))
// Minify
.pipe(minify())
// Save
.pipe(gulp.dest(output))
});
// JS Scripts
gulp.task('scripts', function () {
return gulp.src(jsinput)
.pipe(plugins.concat('/application.js'))
.on("error", plugins.notify.onError(function (error) {
return error.message;
}))
.pipe(plugins.rename({ suffix: '.min' }))
.pipe(plugins.uglify())
.on("error", plugins.notify.onError(function (error) {
return error.message;
}))
.pipe(gulp.dest(jsoutput));
});
//Watch task
gulp.task('watch', function(done) {
gulp.watch(input, gulp.series('styles'));
gulp.watch(jsinput, gulp.series('scripts'));
done();
});