-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
72 lines (63 loc) · 1.56 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
/*
* This file is part of the Lightweight Standard project.
*
* Copyright (c) 2015 LIN3S <info@lin3s.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Gorka Laucirica <gorka.lauzirika@gmail.com>
* @author Beñat Espiña <benatespina@gmail.com>
*/
'use strict';
var
gulp = require('gulp'),
cssNano = require('gulp-cssnano'),
cssnext = require('postcss-cssnext'),
postcss = require('gulp-postcss'),
sass = require('gulp-sass'),
svgSprite = require('gulp-svg-sprite');
var folders = {
assets: './assets',
root: './'
};
var paths = {
sass: folders.assets + '/scss',
svg: folders.assets + '/svg',
buildCss: folders.root + '/css',
buildSvg: folders.root + '/svg'
};
var watch = {
sass: paths.sass + '/**/*.scss',
svg: paths.svg + '/**/*.svg'
};
gulp.task('sass', function () {
return gulp.src(paths.sass + '/app.scss')
.pipe(sass({
errLogToConsole: true
}))
.pipe(postcss([cssnext]))
.pipe(cssNano({
keepSpecialComments: 1,
rebase: false
}))
.pipe(gulp.dest(paths.buildCss));
});
gulp.task('sprites', function () {
return gulp.src(paths.svg + '/*.svg')
.pipe(svgSprite({
mode: {
symbol: {
dest: '',
sprite: 'symbols',
example: {dest: 'symbols'}
}
}
}))
.pipe(gulp.dest(paths.buildSvg));
});
gulp.task('watch', function () {
gulp.watch(watch.sass, ['sass']);
gulp.watch(watch.svg, ['sprites']);
});
gulp.task('default', ['sass', 'sprites']);