-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
55 lines (46 loc) · 1.36 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
var gulp = require('gulp'),
util = require('gulp-util'),
sass = require('gulp-sass'),
gulpif = require('gulp-if'),
autoprefixer = require('gulp-autoprefixer'),
minifyCSS = require('gulp-minify-css'),
del = require('gulp-clean');
var isDev = true;
var isProd = false;
if(util.env.production === 'true') {
isDev = false;
isProd = true;
}
var output_path = 'helsinki/static';
var dev_path = {
sass: ['sass/*.scss', '!sass/_*.scss'],
fonts: ['./node_modules/font-awesome/fonts/fontawesome-webfont.*']
};
var build_path = {
css: output_path + '/css/',
fonts: output_path + '/fonts/'
};
gulp.task('fonts', function () {
return gulp.src(dev_path.fonts)
.pipe(gulp.dest(build_path.fonts));
});
gulp.task('sass', function () {
return gulp.src(dev_path.sass)
.pipe(sass({style: 'expanded', errLogToConsole: true}))
.on('error', function(err) {
console.log(err);
this.emit('end');
})
.pipe(autoprefixer())
.pipe(gulpif(isProd, minifyCSS({noAdvanced: true}))) // minify if Prod
.pipe(gulp.dest(build_path.css));
});
gulp.task('clean-css', function () {
return gulp.src([build_path.css], {read: false})
.pipe(del());
});
gulp.task('watch', function () {
gulp.watch('sass/**/*.scss', ['sass']);
});
gulp.task('build', ['sass', 'fonts']);
gulp.task('default', ['sass','fonts','watch']);