-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgulpfile.js
More file actions
executable file
·100 lines (91 loc) · 2.64 KB
/
gulpfile.js
File metadata and controls
executable file
·100 lines (91 loc) · 2.64 KB
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
/// <binding ProjectOpened='default' />
/// <vs AfterBuild='default' />
var gulp = require('gulp'),
bless = require('gulp-bless'),
compass = require('gulp-for-compass'),
imagemin = require('gulp-imagemin'),
pngquant = require('imagemin-pngquant'),
rev = require('gulp-rev-append'),
minifyCSS = require('gulp-minify-css'),
scsslint = require('gulp-scss-lint'),
livereload = require('gulp-livereload'),
sitespeedio = require('gulp-sitespeedio'),
concat = require('gulp-concat'),
hologram = require('gulp-hologram'),
paths = {
reports: 'Reports/',
src: {
images: 'UI/SRC/Images/',
sass: 'UI/SRC/Sass/',
css: 'UI/SRC/CSS/',
js: 'UI/SRC/JavaScript/'
},
dist: {
images: 'UI/Dist/Images/',
css: 'UI/Dist/CSS/',
js: 'UI/Dist/JavaScript/'
}
},
baseUrl = 'localhost:8888',
templates = [
baseUrl + '/index.html'
];
gulp.task('imageOptim', function () {
return gulp.src(paths.src.images + '*')
.pipe(imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngquant()]
}))
.pipe(gulp.dest(paths.dist.images));
});
gulp.task('rev', function() {
gulp.src('./index.html')
.pipe(rev())
.pipe(gulp.dest('./'));
});
gulp.task('compass', function () {
gulp.src(paths.src.sass + '*.scss')
.pipe(compass({
cssDir: paths.src.css,
sassDir: paths.src.sass,
force: true,
noLineComments: true,
outputStyle: 'compressed',
sourcemap: true,
require: ['susy', 'breakpoint']
}));
});
gulp.task('css', function () {
gulp.src(paths.src.css + '*.css')
.pipe(bless())
.pipe(gulp.dest(paths.dist.css))
.pipe(livereload());
});
gulp.task('scss-lint', function() {
return gulp.src([paths.src.sass + '**/*.scss', '!' + paths.src.sass + 'Vendor/*.scss'])
.pipe(scsslint());
});
gulp.task('scripts', function() {
return gulp.src(paths.src.js)
.pipe(concat('Scripts.min.js'))
.pipe( gulp.dest(paths.dist.js));
});
gulp.task('speed-test', sitespeedio({
urls: templates,
resultBaseDir: paths.reports + 'Speed/',
suppressDomainFolder: true,
html: true
}));
gulp.task('hologram', function() {
gulp.src('./UI/hologram_config.yml')
.pipe(hologram());
});
gulp.task('default', function() {
livereload.listen();
gulp.watch(paths.src.sass + '**/*.scss', ['scss-lint', 'compass', 'hologram']);
gulp.watch(paths.src.css + '**/*.css', ['css']);
gulp.watch(paths.src.images + '*', ['imageOptim']);
gulp.watch(paths.dist.css + '*.css', ['rev']);
gulp.watch(paths.src.js + '**/*.js', ['scripts']);
});