This repository has been archived by the owner on Sep 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
66 lines (55 loc) · 1.53 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
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var runSequence = require('run-sequence');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
gulp.task('template_test', function() {
return gulp.src('test/src/index.html.twig')
.pipe($.twig())
.pipe($.extReplace('.html', '.html.html'))
.pipe($.prettify({ indent_size: 2 }))
.pipe(gulp.dest('test/dest'));
});
AUTOPREFIXER_BROWSERS = [
'ie >= 10',
'ie_mob >= 10',
'ff >= 30',
'chrome >= 34',
'safari >= 7',
'opera >= 23',
'ios >= 7',
'android >= 4.4',
'bb >= 10'
];
var report_error = function(error) {
$.notify({
title: 'An error occured with a Gulp task',
message: 'Check you terminal for more informations'
}).write(error);
console.log(error.toString());
this.emit('end');
};
gulp.task('scss_test', function () {
return gulp.src('test/src/style.scss')
.pipe($.sourcemaps.init())
.pipe($.sass({
precision: 6,
indentWidth: 4,
}))
.on('error', report_error)
.pipe($.autoprefixer({
browsers: AUTOPREFIXER_BROWSERS
}))
.pipe($.sourcemaps.write())
.pipe(gulp.dest('test/dest'));
});
gulp.task('test', ['scss_test', 'template_test']);
gulp.task('test_watch', ['test'], function() {
browserSync({
notify: false,
logPrefix: 'buttons',
server: ['test/dest']
});
gulp.watch(['src/scss/**/*.scss', 'test/src/**/*.scss'], ['scss_test', reload]);
gulp.watch(['test/src/**/*.html.twig', 'src/twig/**/*.html.twig'], ['template_test', reload]);
});