forked from angular/angular-seed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
71 lines (60 loc) · 1.82 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
/* Gulp Variables */
var local = __dirname;
var directories = local.split('/');
var repo = directories[directories.length - 1];
var scssIncludePaths = ['modules', 'globals'];
var file = '--';
console.log(local);
/* Node Dependencies */
var gulp = require('gulp');
var sass = require('gulp-sass');
var rename = require('gulp-rename');
var sourcemaps = require('gulp-sourcemaps');
var sassIncl = require('sass-include-paths');
var run = require('gulp-run');
var plumber = require('gulp-plumber');
var notify = require('gulp-notify');
var gutil = require('gulp-util');
var debug = require('gulp-debug');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var scripts = {
js: [
'assets/js/scripts.js'
]
}
gulp.task('build-scripts', function() {
return gulp.src(scripts.js)
.pipe(concat('lunch.js'))
// .pipe(uglify())
.pipe(gulp.dest('assets/js/min'))
.pipe(notify({ message: 'scripts built' }));
});
gulp.task('default', ['watch']);
gulp.task('build-production', function() {
var onError = function(err) {
notify.onError({
title: "Gulp",
subtitle: "Error: ",
message: "<%= error.message %>",
sound: "Pop"
})(err);
this.emit('end');
}
return gulp.src(local+'/sass/main.scss')
.pipe(plumber({errorHandler: onError}))
.pipe(rename('/lunch.scss'))
.pipe(sass({
includePaths: scssIncludePaths
}))
.pipe(rename('/lunch.css'))
.pipe(gulp.dest(local+'/assets/css'));
});
gulp.task('watch', function() {
var watcher = gulp.watch('sass/**/**/*.scss', ['build-production']);
watcher.on('change', function(e) {
file = e.path.split('/');
file = file.slice(-3).join('/');
console.log('Building after file '+file+' was chanaged...');
});
});