-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
72 lines (63 loc) · 1.83 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
'use strict';
const gulp = require('gulp'),
sass = require('gulp-sass'),
uglify = require('gulp-uglify'),
jshint = require('gulp-jshint'),
rename = require('gulp-rename'),
fs = require('fs'),
cleanCSS = require('gulp-clean-css'),
browserSync = require('browser-sync').create(),
reload = browserSync.reload;
gulp.task('default', ['styles:build', 'scripts:build', 'modules-js:build'], function() {
});
gulp.task('server', function() {
// Run the local server
browserSync.init({
notify: false,
port: 9000,
ui: false,
server: {
baseDir: './',
routes: {
'/bower_components': 'bower_components'
}
}
});
gulp.watch('assets/scss/**/*.scss', ['styles:build']);
gulp.watch('assets/coffee/**/*.js', ['scripts:build']);
gulp.watch('modules/**/*.js', ['modules-js:build']);
gulp.watch([
'assets/scss/**/*.scss',
'assets/coffee/**/*.js',
'modules/**/*.js',
]).on('change', reload);
});
gulp.task('styles:build', function() {
return gulp.src('assets/scss/**/*.scss')
.pipe(sass.sync().on('error', sass.logError))
.pipe(cleanCSS())
.pipe(rename({
suffix: ".min",
}))
.pipe(gulp.dest('assets/css'));
});
gulp.task('scripts:build', function() {
return gulp.src('assets/coffee/**/*.js')
.pipe(jshint())
.pipe(jshint.reporter())
.pipe(uglify())
.pipe(rename({
suffix: ".min",
}))
.pipe(gulp.dest('assets/js'));
});
gulp.task('modules-js:build', function() {
return gulp.src('assets/coffee/**/*.js')
.pipe(jshint())
.pipe(jshint.reporter())
.pipe(uglify())
.pipe(rename({
suffix: ".min",
}))
.pipe(gulp.dest('assets/js'));
});