-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
62 lines (50 loc) · 1.38 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
// GULP PACKAGES
// Most packages are lazy loaded
var gulp = require('gulp'),
gutil = require('gulp-util'),
filter = require('gulp-filter'),
plugin = require('gulp-load-plugins')();
// GULP VARIABLES
// Modify these variables to match your project needs
// Select Foundation components, remove components project will not use
const SOURCE = {
// Scss files will be concantonated, minified if ran with --production
styles: 'assets/scss/**/*.scss',
html: '**/*.html'
};
const ASSETS = {
styles: 'assets/css/',
scripts: 'assets/js/',
images: 'assets/img/',
all: 'assets/'
};
// GULP FUNCTIONS
// JSHint, concat, and minify JavaScript
// Compile Sass, Autoprefix and minify
gulp.task('styles', function () {
return gulp.src(SOURCE.styles)
.pipe(plugin.plumber(function (error) {
gutil.log(gutil.colors.red(error.message));
this.emit('end');
}))
.pipe(plugin.sourcemaps.init())
.pipe(plugin.sass())
.pipe(plugin.autoprefixer({
browsers: [
'last 2 versions',
'ie >= 9',
'ios >= 7'
],
cascade: false
}))
.pipe(plugin.cssnano())
.pipe(plugin.sourcemaps.write('.'))
.pipe(gulp.dest(ASSETS.styles))
});
// Watch files for changes (without Browser-Sync)
gulp.task('watch', function () {
// Watch .scss files
gulp.watch(SOURCE.styles, gulp.parallel('styles'));
});
// Run styles, scripts and foundation-js
gulp.task('default', gulp.parallel('styles'));