forked from stephnr/electron-angular-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
68 lines (54 loc) · 1.99 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
'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 = 'src/scss';
const cssRoot = 'dist/css';
const views = 'views/**/*.html';
const viewsRoot = 'views/';
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('watch-sass', () => {
plugins.notify('Sass Stream is Active...');
gulp.watch(sassRoot+'/**/*.scss', ['build-sass']);
});
// ############################################################################################
// ############################################################################################
gulp.task('default', ['build-sass', 'inject-dependencies'], () => {
gutil.log('Transposing Sass...');
});
gulp.task('clean', ['clean:styles']);
gulp.task('watch', ['watch-sass']);