-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgulpfile.js
47 lines (42 loc) · 1.31 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
47
'use scrice';
var gulp = require('gulp'),
sass = require('gulp-sass'),
plugins = require('gulp-load-plugins')(),
livereload = plugins.livereload,
logger = require('winston'),
fs = require('fs');
gulp.task('css', function() {
return gulp.src('src/*.scss')
.pipe(sass({ indentWidth: 4 }).on('error', sass.logError))
.pipe(plugins.autoprefixer({
browsers: ['last 2 version', '> 5%', 'ie 10', 'ff 10', 'opera 15', 'chrome 12']
}))
.pipe(gulp.dest('dist/'))
.pipe(plugins.minifyCss())
.pipe(plugins.rename(function (path) {
path.extname = '.min.css';
}))
.pipe(gulp.dest('dist/'));
});
gulp.task('js', function() {
return gulp.src('src/*.js')
.pipe(gulp.dest('dist/'))
.pipe(plugins.uglify())
.pipe(plugins.rename(function (path) {
path.extname = '.min.js';
}))
.pipe(gulp.dest('dist/'));
});
gulp.task('dev', function() {
livereload.listen({
start: true
});
gulp.watch('src/*.*', ['css', 'js']).on('change', function(file) {
livereload.changed('example/index.html');
});
gulp.watch('example/*').on('change', function(file) {
livereload.changed(file);
})
});
gulp.task('build', ['css', 'js']);
gulp.task('default', ['build']);