-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
100 lines (94 loc) · 2.85 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
'use strict';
var gulp = require('gulp');
var filter = require('gulp-filter');
var sass = require('gulp-sass');
var minifyCss = require('gulp-minify-css');
var uglify = require('gulp-uglify');
var autoprefixer = require('gulp-autoprefixer');
var concat = require('gulp-concat');
var gulp = require('gulp');
var sass = require('gulp-sass');
var svgSprite = require('gulp-svg-sprite');
// The basic configuration
var config = {
bowerDir: './bower_components',
svgSprites: {
shape: {
shape: {
dimension: {
maxWidth: 24,
maxHeight: 24
}
},
transform: [
{
svgo: {
plugins: [
{removeAttrs: {attrs: '(stroke|fill)'}}
]
}
}
]
},
mode: {
symbol: {
dest: 'img',
sprite: 'icons.svg',
prefix: '.icon-%s',
bust: false
}
}
}
};
/**
* CSS (concat, compile, autoprefix, minify, sourcemaps)
*/
gulp.task('css', function () {
// Sass config
var sassConfig = {
advanced: true,
aggressiveMerging: true,
mediaMerging: true,
precision: 10,
includePaths: [config.bowerDir]
};
return gulp.src('./src/source/styles/template.scss')
.pipe(sass(sassConfig).on('error', sass.logError))
.pipe(autoprefixer())
.pipe(minifyCss())
.pipe(concat('template.min.css'))
.pipe(gulp.dest('./src/css/'));
});
/**
* JS (concat, minify, sourcemaps)
*/
gulp.task('js', function () {
return gulp.src([
config.bowerDir + '/bootstrap-sass/assets/javascripts/bootstrap/collapse.js',
config.bowerDir + '/bootstrap-sass/assets/javascripts/bootstrap/dropdown.js',
config.bowerDir + '/bootstrap-sass/assets/javascripts/bootstrap/transition.js',
config.bowerDir + '/scrollmagic/scrollmagic/uncompressed/ScrollMagic.js',
config.bowerDir + '/scrollmagic/scrollmagic/uncompressed/plugins/debug.addIndicators.js',
config.bowerDir + '/jquery-countTo/jquery.countTo.js',
config.bowerDir + '/blockadblock/blockadblock.js',
'./src/source/scripts/template.js'
])
.pipe(uglify())
.pipe(concat('template.min.js'))
.pipe(gulp.dest('./src/js/'));
});
/**
* Create the svg icon sprite
*/
gulp.task('svg', function () {
gulp.src('./src/source/icons/svg/**/*.svg')
.pipe(svgSprite(config.svgSprites))
.pipe(gulp.dest('./src'));
});
/**
* Default Watcher
*/
gulp.task('default', ['css', 'js'], function () {
gulp.watch(['./src/source/styles/**/*.scss'], ['css']);
gulp.watch(['./src/source/scripts/**/*.js'], ['js']);
});