forked from fourkitchens/example-acquia-8-composer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
62 lines (57 loc) · 1.67 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
(function () {
'use strict';
let gulp = require('gulp-help')(require('gulp'));
let concat = require('gulp-concat');
let config = require('./gulp-config');
let glob = require('glob');
let sass = require('gulp-sass');
let sassGlob = require('gulp-sass-glob');
let sassLint = require('gulp-sass-lint');
let sourcemaps = require('gulp-sourcemaps');
let eyeglass = require('eyeglass');
let prefix = require('gulp-autoprefixer');
let imagemin = require('gulp-imagemin');
require('project-gulp')(gulp, ['phpcs', 'eslint']);
/**
* Task for minifying images.
*/
gulp.task('imagemin', function () {
return gulp.src(config.paths.img + '/**/*')
.pipe(imagemin({
progressive: true,
svgoPlugins: [
{removeViewBox: false},
{cleanupIDs: false}
]
}))
.pipe(gulp.dest(config.paths.dist_img));
});
/**
* SASS Task
*/
gulp.task('css', function () {
return gulp.src([config.paths.sass + '/**/*.scss'])
.pipe(sourcemaps.init())
.pipe(sassGlob())
.pipe(sassLint())
.pipe(sassLint.format())
.pipe(sassLint.failOnError())
.pipe(sass(eyeglass(config.sassOptions)).on('error', sass.logError))
.pipe(prefix(['last 1 version', '> 1%', 'ie 10']))
.pipe(sourcemaps.write())
.pipe(gulp.dest(config.paths.dist_css));
});
/**
* Scripts Task
*/
gulp.task('scripts', function () {
return gulp.src(config.paths.js + '/**/*.js')
.pipe(concat('scripts.js'))
.pipe(gulp.dest(config.paths.dist_js));
});
gulp.task('styles', ['css']);
/**
* Theme task declaration
*/
gulp.task('build', ['imagemin', 'styles', 'scripts']);
})();