forked from helsingborg-stad/Modularity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
91 lines (79 loc) · 3.03 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
// Include gulp
var gulp = require('gulp');
// Include Our Plugins
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var minifycss = require('gulp-minify-css');
var rename = require('gulp-rename');
var autoprefixer = require('gulp-autoprefixer');
var plumber = require('gulp-plumber');
// Compile Our Sass
gulp.task('sass-dist', function() {
gulp.src('source/sass/modularity.scss')
.pipe(plumber())
.pipe(sass())
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1'))
.pipe(rename({suffix: '.min'}))
.pipe(minifycss())
.pipe(gulp.dest('dist/css'));
gulp.src('source/sass/modularity-thickbox-edit.scss')
.pipe(plumber())
.pipe(sass())
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1'))
.pipe(rename({suffix: '.min'}))
.pipe(minifycss())
.pipe(gulp.dest('dist/css'));
gulp.src('source/php/Module/*/assets/*.scss')
.pipe(plumber())
.pipe(sass())
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1'))
.pipe(rename({suffix: '.min'}))
.pipe(minifycss())
.pipe(gulp.dest('dist/css'));
});
gulp.task('sass-dev', function() {
gulp.src('source/sass/modularity.scss')
.pipe(plumber())
.pipe(sass())
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1'))
.pipe(rename({suffix: '.dev'}))
.pipe(gulp.dest('dist/css'));
gulp.src('source/sass/modularity-thickbox-edit.scss')
.pipe(plumber())
.pipe(sass())
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1'))
.pipe(rename({suffix: '.dev'}))
.pipe(gulp.dest('dist/css'));
});
// Concatenate & Minify JS
gulp.task('scripts-dist', function() {
gulp.src([
'source/js/**/*.js',
'!source/js/modularity-editor-modal.js'
])
.pipe(concat('modularity.dev.js'))
.pipe(gulp.dest('dist/js'))
.pipe(rename('modularity.min.js'))
.pipe(uglify())
.pipe(gulp.dest('dist/js'));
gulp.src('source/php/Module/*/assets/*.js')
.pipe(uglify())
.pipe(gulp.dest('dist/js'));
gulp.src('source/js/modularity-editor-modal.js')
.pipe(concat('modularity-editor-modal.dev.js'))
.pipe(gulp.dest('dist/js'))
.pipe(rename('modularity-editor-modal.min.js'))
.pipe(uglify())
.pipe(gulp.dest('dist/js'));
});
// Watch Files For Changes
gulp.task('watch', function() {
gulp.watch(['Source/js/**/*.js', 'source/php/Module/*/assets/*.js'], ['scripts-dist']);
gulp.watch('Source/sass/**/*.scss', ['sass-dist', 'sass-dev']);
gulp.watch('source/php/Module/*/assets/*.scss', ['sass-dist', 'sass-dev']);
});
// Build Task
gulp.task('build', ['sass-dist', 'sass-dev', 'scripts-dist']);
// Default Task
gulp.task('default', ['build', 'watch']);