forked from humaan/Modaal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
100 lines (86 loc) · 2.28 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
92
93
94
95
96
97
98
99
100
var gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
notify = require('gulp-notify'),
del = require('del'),
mmq = require('gulp-merge-media-queries'),
cleanCSS = require('gulp-clean-css');
// Development tasks
// ----------------------------------------------------------------------
gulp.task('styles', function() {
gulp.src('source/css/modaal.scss')
.pipe(sass({
style: 'expanded',
sourcemap: false
})
.on('error', sass.logError))
.pipe(autoprefixer({
browsers: 'last 3 versions, Explorer > 8, android 4'
}))
.pipe(mmq({
log: true
}))
.pipe(gulp.dest('source/css'))
.pipe(notify({
message: 'Modaal styles task complete'
}));
});
// For demo website only, can be removed
gulp.task('demo-styles', function() {
gulp.src('demo/css/demo.scss')
.pipe(sass({
style: 'expanded',
sourcemap: false
})
.on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 2 version', 'ie 8', 'ie 9']
}))
.pipe(gulp.dest('demo/css'))
.pipe(notify({
message: 'Demo styles task complete'
}));
});
gulp.task('watch', function() {
gulp.watch('source/css/*.scss', ['styles']);
gulp.watch('demo/css/*.scss', ['demo-styles']);
});
// Distribute tasks
// ----------------------------------------------------------------------
gulp.task('min-modaal', function() {
gulp.src(['source/js/modaal.js'])
.pipe(uglify({
preserveComments: 'some'
}))
.pipe(rename({
suffix: '.min',
extname: '.js'
}))
.pipe(gulp.dest('dist/js/'))
.pipe(notify({
message: 'Successfully uglified Modaal.'
}));
gulp.src(['source/css/*.css'])
.pipe(cleanCSS({compatibility: 'ie9'}))
.pipe(rename({
extname : '.min.css'
}))
.pipe(gulp.dest('dist/css/'))
.pipe(notify({ message: 'Min copy created.' }));
});
gulp.task('copy-to-dist', function() {
// copy other files to dist folder
gulp.src('source/js/modaal.js')
.pipe(gulp.dest('dist/js/'));
gulp.src('source/css/modaal.scss')
.pipe(gulp.dest('dist/css/'));
gulp.src('source/css/modaal.css')
.pipe(gulp.dest('dist/css/'))
.pipe(notify({
message: 'Moved to dist.'
}));
});
// Now run in order
gulp.task('dist', ['min-modaal', 'copy-to-dist']);