-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
executable file
·48 lines (40 loc) · 1.43 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
48
'use strict';
var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var sass = require('gulp-sass');
var maps = require('gulp-sourcemaps');
var livereload = require('gulp-livereload');
var autoprefixer = require('gulp-autoprefixer');
gulp.task('concatScripts', function(){
return gulp.src([
'./inc/**.js',
'./js/**.js'])
.pipe(maps.init())
.pipe(concat('scripts.js'))
.pipe(maps.write('./'))
.pipe(gulp.dest('./assets/js'));
});
gulp.task('minifyScripts', ['concatScripts'], function(){
return gulp.src('./assets/js/scripts.js')
.pipe(uglify())
.pipe(gulp.dest('./assets/js'));
});
gulp.task('compileSass', function(){
return gulp.src('./sass/**/*.scss')
.pipe(maps.init())
.pipe(sass({includePaths: require('bourbon').includePaths}))
.pipe(autoprefixer())
.pipe(maps.write('./'))
.pipe(gulp.dest('./'))
.pipe(livereload());
});
gulp.task('watchFiles', function(){
livereload.listen();
gulp.watch(['./sass/**/*.scss','./scss/*.scss'],['compileSass']);
gulp.watch(['./js/**.js','./inc/**/*.js','./assets/**.js'], ['concatScripts']);
});
gulp.task('build', ['minifyScripts', 'compileSass']);
gulp.task('watch', ['watchFiles']);
gulp.task('default', ['concatScripts', 'compileSass']);