-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
62 lines (58 loc) · 1.49 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
58
59
60
61
62
const { src, dest, watch, parallel } = require('gulp');
const uglify = require('gulp-uglify');
const rename = require('gulp-rename');
const sourcemaps = require('gulp-sourcemaps');
const concat = require('gulp-concat');
const sass = require('gulp-sass')(require('sass'));
const order = require("gulp-order");
const cleanCSS = require('gulp-clean-css');
// SASS
function sassBuild(cb) {
return src('css/**/*.scss')
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(concat('screensaver.css'))
.pipe(cleanCSS({compatibility: 'ie9'}))
.pipe(rename({suffix: '.min'}))
.pipe(sourcemaps.write())
.pipe(dest('public/dist/'));
cb();
};
// Concatenate & Minify JS
function jsBuild(cb) {
return src('js/**/*.js')
.pipe(order([
'js/app.js',
'js/backbone-viewstate.js',
'js/Store.js',
'js/twitter.js',
'js/youtube.js',
'js/views/slideshow.js',
'js/data.js',
'js/**/*.js'
]))
.pipe(sourcemaps.init())
.pipe(concat('screensaver.js'))
.pipe(uglify().on('error', function(e){
console.log(e);
}))
.pipe(rename({suffix: '.min'}))
.pipe(sourcemaps.write())
.pipe(dest('public/dist/'));
cb();
};
// default gulp task
function defaultTask(cb) {
watch([
'css/**/*.scss'
], sassBuild);
watch([
'public/*.html',
'js/**/*.js'
], jsBuild);
cb();
};
exports.js = jsBuild;
exports.sass = sassBuild;
exports.build = parallel(sassBuild, jsBuild);
exports.default = defaultTask;