-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
92 lines (72 loc) · 2.57 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
80
81
82
83
84
85
86
87
88
89
90
91
92
'use strict';
const del = require('del');
const gulp = require('gulp');
const gutil = require('gulp-util');
const gulpLoadPlugins = require('gulp-load-plugins');
let wiredep = require('wiredep').stream;
const plugins = gulpLoadPlugins();
const sassRoot = 'app/styles';
const cssRoot = 'dist/css';
const views = 'app/views/**/*.html';
const viewsRoot = 'dist/views/';
const controllers = 'app/scripts/controllers';
const controllersRoot = 'dist/scripts/controllers/';
const sounds = 'app/sounds';
const soundsRoot = 'dist/sounds/';
const images = 'app/images';
const imagesRoot = 'dist/images/';
function handleError(err) {
console.log(err.toString());
}
// ############################################################################################
// ############################################################################################
gulp.task('clean:styles', (cb) => {
del([
'**/.sass-cache/**',
], cb);
});
gulp.task('inject-dependencies', function() {
return gulp.src(views)
.pipe(wiredep())
.pipe(plugins.rename(function(path) {
path.extname = '.html';
}))
.pipe(gulp.dest(viewsRoot));
});
gulp.task('build-sass', () => {
return gulp.src(sassRoot+'/*.scss')
.pipe(plugins.plumber())
.pipe(plugins.notify('Compile Sass File: <%= file.relative %>...'))
.pipe(plugins.sourcemaps.init())
.pipe(plugins.autoprefixer('last 10 versions'))
.pipe(plugins.sass({
style: 'compressed'
})).on('error', handleError)
.pipe(plugins.sourcemaps.write())
.pipe(gulp.dest(cssRoot));
});
gulp.task('move-js', () => {
return gulp.src(controllers+'/*')
.pipe(gulp.dest(controllersRoot));
});
gulp.task('move-sounds', () => {
return gulp.src(sounds+'/*.*')
.pipe(gulp.dest(soundsRoot));
});
gulp.task('move-images', () => {
return gulp.src(images+'/*.*')
.pipe(gulp.dest(imagesRoot));
});
// ############################################################################################
// ############################################################################################
gulp.task('watch-sass', () => {
plugins.notify('Sass Stream is Active...');
gulp.watch(sassRoot+'/**/*.scss', ['build-sass']);
});
// ############################################################################################
// ############################################################################################
gulp.task('default', ['build-sass', 'inject-dependencies', 'move-js', 'move-sounds', 'move-images'], () => {
gutil.log('Transposing Sass...');
});
gulp.task('clean', ['clean:styles']);
gulp.task('watch', ['watch-sass']);