-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
executable file
·63 lines (56 loc) · 1.84 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
var del = require('del'),
gulp = require('gulp'),
log = require('fancy-log'),
watch = require('gulp-watch'),
stylus = require('gulp-stylus'),
rename = require("gulp-rename"),
concat = require('gulp-concat'),
notify = require('gulp-notify'),
cleanCSS = require('gulp-clean-css'),
runSequence = require('gulp4-run-sequence');
// The Init task it's for copy the javascript dependencies to the src folder.
gulp.task('init', function() {
gulp.src('node_modules/normalize.css/normalize.css')
.pipe(gulp.dest('src/assets/css/compile/vendor'))
.pipe(notify('The initialization of the project has been succesful!'))
});
// Compile Stylus CSS
gulp.task('style', function (done) {
gulp.src('src/assets/css/compile/styl/main.styl')
.pipe(stylus({
'include css': true
}))
.pipe(cleanCSS())
.pipe(rename('style.css'))
.pipe(gulp.dest('src/assets/css'))
.pipe(notify('CSS Compiled!'));
done();
});
// Watch
gulp.task('watch', function() {
gulp.watch('src/assets/css/compile/styl/*.styl', gulp.series('style'));
});
gulp.task('cleanBuild', function () {
return del('build');
});
gulp.task('copy', function(done) {
gulp.src('src/*.*')
.pipe(gulp.dest('build/'))
gulp.src('src/assets/css/style.css')
.pipe(gulp.dest('build/assets/css/'))
gulp.src('src/assets/js/*.js')
.pipe(gulp.dest('build/assets/js/'))
gulp.src('src/assets/img/**/*')
.pipe(gulp.dest('build/assets/img/'))
.pipe(notify('All the resources has been copied to the build folder.'));
done();
});
gulp.task('build', function(callback) {
runSequence(
'style',
'copy',
callback
);
});
// Default gulp task to run
gulp.task('default', gulp.series('watch'));