-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
117 lines (104 loc) · 2.81 KB
/
gulpfile.js
File metadata and controls
117 lines (104 loc) · 2.81 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var del = require('del');
var autoprefixer = require('autoprefixer');
var shell = require('gulp-shell');
var _css_watch = [
'html/themes/custom/ib3/src/sass/*.s+(a|c)ss',
'html/modules/custom/**/sass/*.s+(a|c)ss'
];
var _css = [
'html/themes/custom/ib3/src/sass/ib3.scss',
];
var _fonts = [
'vendor/fortawesome/font-awesome/fonts/fontawesome-webfont.eot',
'vendor/fortawesome/font-awesome/fonts/fontawesome-webfont.svg',
'vendor/fortawesome/font-awesome/fonts/fontawesome-webfont.ttf',
'vendor/fortawesome/font-awesome/fonts/fontawesome-webfont.woff',
'vendor/fortawesome/font-awesome/fonts/fontawesome-webfont.woff2',
'vendor/fortawesome/font-awesome/fonts/FontAwesome.otf'
];
var _js_watch = [
'node_modules/jquery/dist/jquery.js',
'node_modules/popper.js/dist/umd/popper.js',
'node_modules/bootstrap/dist/js/bootstrap.js',
'html/themes/custom/ib3/src/js/*.js',
'html/modules/custom/**/js/*.js'
];
var _js = [
'node_modules/jquery/dist/jquery.js',
'node_modules/popper.js/dist/umd/popper.js',
'node_modules/bootstrap/dist/js/bootstrap.js',
'html/themes/custom/ib3/src/js/*.js'
];
/**
* @task sass
* Do sass stuff.
*/
gulp.task('sass', function () {
var pcPlug = {
autoprefixer: require('autoprefixer'),
mqpacker: require('css-mqpacker')
};
var pcProcess = [
pcPlug.autoprefixer({
browsers: ['> 1%', 'last 2 versions', 'firefox >= 4', 'safari 7', 'safari 8', 'IE 8', 'IE 9', 'IE 10', 'IE 11']
}),
pcPlug.mqpacker()
];
return gulp.src(_css)
.pipe($.sourcemaps.init())
.pipe($.sass())
.on('error', function (err) {
console.log(err);
this.emit('end');
})
.pipe($.postcss(pcProcess))
.pipe($.sourcemaps.write())
.pipe(gulp.dest('html/themes/custom/ib3/static/css'));
});
/**
* @task js
* Do javascript stuff.
*/
gulp.task('js', function () {
return gulp.src(_js)
.pipe($.concat('ib3.js'))
.pipe($.uglify())
.pipe(gulp.dest('html/themes/custom/ib3/static/js'));
});
/**
* @task clean
* Clean the dist folder.
*/
gulp.task('clean', function () {
return del([
'html/themes/custom/ib3/static/css/*',
'html/themes/custom/ib3/static/js/*',
'html/themes/custom/ib3/static/fonts/*'
]);
});
gulp.task('fonts', function () {
return gulp.src(_fonts)
.pipe(gulp.dest('html/themes/custom/ib3/static/fonts'));
});
/**
* @task cache
* Clear the drupal cache.
*/
gulp.task('cache', shell.task([
'./vendor/bin/drupal cr all'
]));
/**
* @task watch
* Watch files and do stuff.
*/
gulp.task('watch', ['clean', 'sass', 'js', 'fonts', 'cache'], function () {
gulp.watch(_css_watch, ['clean','sass','js','fonts','cache']);
gulp.watch(_js_watch, ['clean','sass','js','fonts','cache']);
});
/**
* @task default
* Watch files and do stuff.
*/
gulp.task('default', ['watch']);