-
Notifications
You must be signed in to change notification settings - Fork 49
/
gulpfile.js
57 lines (48 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
49
50
51
52
53
54
55
56
57
"use strict";
var gulp = require('gulp'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
sass = require('gulp-sass'),
maps = require('gulp-sourcemaps'),
del = require('del');
gulp.task("concatScripts", function() {
return gulp.src([
'js/jquery.js',
'js/sticky/jquery.sticky.js',
'js/main.js'
])
.pipe(maps.init())
.pipe(concat('app.js'))
.pipe(maps.write('./'))
.pipe(gulp.dest('js'));
});
gulp.task("minifyScripts", ["concatScripts"], function() {
return gulp.src("js/app.js")
.pipe(uglify())
.pipe(rename('app.min.js'))
.pipe(gulp.dest('js'));
});
gulp.task('compileSass', function() {
return gulp.src("scss/application.scss")
.pipe(maps.init())
.pipe(sass())
.pipe(maps.write('./'))
.pipe(gulp.dest('css'));
});
gulp.task('watchFiles', function() {
gulp.watch('scss/**/*.scss', ['compileSass']);
gulp.watch('js/main.js', ['concatScripts']);
})
gulp.task('clean', function() {
del(['dist', 'css/application.css*', 'js/app*.js*']);
});
gulp.task("build", ['minifyScripts', 'compileSass'], function() {
return gulp.src(["css/application.css", "js/app.min.js", 'index.html',
"img/**", "fonts/**"], { base: './'})
.pipe(gulp.dest('dist'));
});
gulp.task('serve', ['watchFiles']);
gulp.task("default", ["clean"], function() {
gulp.start('build');
});