forked from Mozart2234/alexei-ghost
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
99 lines (83 loc) · 2.2 KB
/
gulpfile.js
File metadata and controls
99 lines (83 loc) · 2.2 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
/*
* Dependencias
*/
var gulp = require('gulp'),
stylus = require('gulp-stylus'),
uglify = require('gulp-uglify'),
minifyCss = require('gulp-minify-css'),
connect = require('gulp-connect'),
concat = require('gulp-concat'),
gulpif = require('gulp-if'),
nib = require('nib');
var livereload = false;
// Compila Styl a CSS
gulp.task('stylus', function () {
gulp.src('./assets/stylus/style.styl')
.pipe(stylus({
compress: true,
use: nib()
}))
.pipe(gulp.dest('./assets/css/'))
.pipe(gulpif(livereload, connect.reload()))
});
// Reload cuando cambia un archivo html
gulp.task('html', function () {
gulp.src('./*.html')
.pipe(connect.reload());
});
// Reload cuando cambia un archivo js
gulp.task('js', function () {
gulp.src('./assets/js-dev/*.js')
.pipe(connect.reload());
});
// Levantar servidor con livereload
gulp.task('connect', function () {
connect.server({
root: '.',
hostname: '0.0.0.0',
port: 9000,
livereload: true
});
livereload = true;
})
//Minify JS
gulp.task('minify-js', function(){
return gulp.src('./assets/js-dev/*.js')
.pipe(uglify())
.pipe(gulp.dest('./assets/js/'))
})
// Minifica CSS externos
gulp.task('minify-css', function() {
return gulp.src('./assets/css-dev/vendor/*.css')
.pipe(minifyCss())
.pipe(gulp.dest('./assets/css/vendor/'))
})
// Minify JS externos
gulp.task('minify-js-vendor', function() {
return gulp.src('./assets/js-dev/vendor/*.js')
.pipe(uglify())
.pipe(gulp.dest('./assets/js/vendor/'))
})
// Concat CSS
gulp.task('css-concat', function(){
return gulp.src('./assets/css/vendor/*.css')
.pipe(concat('vendor.css'))
.pipe(gulp.dest('./assets/css/vendor/'))
})
// Vendor-css
gulp.task('js-concat',function(){
return gulp.src('./assets/js/vendor/*.js')
.pipe(concat('vendor.js'))
.pipe(gulp.dest('./assets/js/vendor/'))
})
// Gulp Watch
gulp.task('watch', function() {
gulp.watch(['./*.html'], ['html']);
gulp.watch('./assets/stylus/*.styl', ['stylus']);
gulp.watch('./assets/js-dev/*.js', ['js']);
})
gulp.task('watch-stylus', function(){
gulp.watch('./assets/stylus/*.styl', ['stylus']);
})
// Default gulp
gulp.task('default', ['connect', 'watch']);