forked from isotope/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
59 lines (52 loc) · 1.56 KB
/
Copy pathgulpfile.js
File metadata and controls
59 lines (52 loc) · 1.56 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
'use strict';
const gulp = require('gulp');
const rename = require('gulp-rename');
const gutil = require('gulp-util');
const uglify = require('gulp-uglify');
const cleanCSS = require('gulp-clean-css');
const production = true;
// Configuration
const scripts = [
'system/modules/isotope/assets/js/*.js',
'!system/modules/isotope/assets/js/*.min.js'
];
const styles = [
'system/modules/isotope/assets/css/isotope.css',
'!system/modules/isotope/assets/css/*.min.css',
'system/modules/isotope_reports/assets/*.css',
'!system/modules/isotope_reports/assets/*.min.css'
];
// Build scripts
gulp.task('scripts', function () {
return gulp.src(scripts, {base: './'})
.pipe(production ? uglify() : gutil.noop())
.pipe(rename(function (path) {
path.extname = '.min' + path.extname;
}))
.pipe(gulp.dest('./'));
});
// Build styles
gulp.task('styles', function () {
return gulp.src(styles, {base: './'})
.pipe(production ? cleanCSS({'restructuring': false, 'processImport': false}) : gutil.noop())
.pipe(rename(function (path) {
path.extname = '.min' + path.extname;
}))
.pipe(gulp.dest('./'));
});
// Watch task
gulp.task('watch', function () {
gulp.watch(
['system/modules/isotope/assets/js/*.js'],
['scripts']
);
gulp.watch(
[
'system/modules/isotope/assets/css/*.css',
'system/modules/isotope_reports/assets/*.css'
],
['styles']
);
});
// Build by default
gulp.task('default', ['styles', 'scripts']);