-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
90 lines (79 loc) · 3.02 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
var del = require('del');
var gulp = require('gulp');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
// =====================================================================================================================
// *.scss compilation
// =====================================================================================================================
var foundationPaths = [
'node_modules/foundation-sites/scss',
'node_modules/motion-ui/src'
];
var materialPaths = [
'node_modules/@angular/material'
];
gulp.task('sass.foundation', function(){
return gulp.src('styles/foundation/foundation_core.scss')
.pipe(sourcemaps.init())
.pipe(sass({
includePaths: foundationPaths,
outputStyle: 'compressed'
}).on('error', sass.logError))
.pipe(sourcemaps.write())
.pipe(gulp.dest('styles/foundation'));
});
gulp.task('sass.material', function(){
return gulp.src('styles/components/material.scss')
.pipe(sourcemaps.init())
.pipe(sass({
includePaths: materialPaths.concat(foundationPaths),
outputStyle: 'compressed'
}).on('error', sass.logError))
.pipe(sourcemaps.write())
.pipe(gulp.dest('styles/components'));
});
gulp.task('sass.app', function(){
return gulp.src('styles/app.scss')
.pipe(sourcemaps.init())
.pipe(sass({
includePaths: foundationPaths,
outputStyle: 'compressed'
}).on('error', sass.logError))
.pipe(sourcemaps.write())
.pipe(gulp.dest('styles'));
});
gulp.task('sass.components', function(){
return gulp.src('app/**/*.scss')
.pipe(sass({
includePaths: foundationPaths
}).on('error', sass.logError))
.pipe(gulp.dest('app')); // compile in-place
});
gulp.task('sass', ['sass.foundation', 'sass.material', 'sass.app', 'sass.components']);
// =====================================================================================================================
// Cleaner
// =====================================================================================================================
gulp.task('clean.css', function() {
return del([
'styles/app.css', // generated by sass.app
'app/**/*.component.css', // generated by sass.components
'styles/components/material.css', // generated by sass.material
'styles/foundation/foundation_code.css' // generated by sass.foundation
])
});
gulp.task('clean.js', function() {
return del([
'app/**/*.map',
'app/**/*.js'
])
});
gulp.task('clean', ['clean.css', 'clean.js']);
// =====================================================================================================================
// Gulp watcher
// =====================================================================================================================
gulp.task('watch', function(){
gulp.watch('styles/foundation/*.scss', ['sass.foundation']);
gulp.watch('styles/components/*.scss', ['sass.material']);
gulp.watch('styles/*.scss', ['sass.app']);
gulp.watch('app/**/*.scss', ['sass.components']);
});