-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
79 lines (66 loc) · 2.07 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
var gulp = require('gulp');
var gulpconfig = require('./gulpconfig')
/**
* Modules
*/
var autoprefixer = require('gulp-autoprefixer');
var browserify = require('gulp-browserify');
var del = require('del');
var livereload = require('gulp-livereload');
var modernizr = require('gulp-modernizr');
var sass = require('gulp-sass')
var uglify = require('gulp-uglify');
/**
* Gulp Build Tasks
*/
gulp.task('default', ['sass', 'javascript']);
gulp.task('build', ['modernizr', 'sass', 'assets', 'javascript', 'copy', 'templates']);
/**
* Gulp Tasks
* @return {[type]} [description]
*/
gulp.task('assets', function () {
gulp.src(gulpconfig.assets.src)
.pipe(gulp.dest(gulpconfig.assets.dest))
});
gulp.task('clean', function (callback) {
del(gulpconfig.clean.src, callback);
});
gulp.task('copy', function () {
gulp.src(gulpconfig.copy.js.src)
.pipe(gulp.dest(gulpconfig.copy.js.dest))
});
gulp.task('javascript', function () {
gulp.src('modules/*.js')
.pipe(browserify())
.on('error', function (error) {
console.log(error.message);
})
.pipe(uglify())
.pipe(gulp.dest(gulpconfig.js.dest));
});
gulp.task('modernizr', function () {
gulp.src(gulpconfig.sass.modules)
.pipe(modernizr(gulpconfig.modernizr.settings))
.pipe(uglify())
.pipe(gulp.dest(gulpconfig.js.dest))
});
gulp.task('sass', function () {
gulp.src(gulpconfig.sass.modules)
.pipe(sass({
outputStyle : 'compressed',
errLogToConsole: true
}))
.pipe(autoprefixer(gulpconfig.autoprefixer))
.pipe(gulp.dest(gulpconfig.css.dest));
});
gulp.task('templates', function () {
gulp.src(gulpconfig.templates.src)
.pipe(gulp.dest(gulpconfig.templates.dest))
});
gulp.task('watch', function () {
livereload.listen();
gulp.watch(gulpconfig.sass.modules, ['sass']).on('change', livereload.changed);
gulp.watch(gulpconfig.templates.src, ['templates']).on('change', livereload.changed);
gulp.watch(gulpconfig.js.src, ['javascript']).on('change', livereload.changed);
});