-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
76 lines (63 loc) · 1.52 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
var gulp = require('gulp');
var stylus = require('gulp-stylus');
var rename = require('gulp-rename');
var babel = require('babelify');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
//var watchify = require('watchify');
gulp.task('styles', function(){
gulp
.src('assets/css/main.styl')
.pipe(stylus())
.pipe(rename('mainApp.css'))
.pipe(gulp.dest('public/css/'));
})
gulp.task('assets', function(){
gulp
.src('assets/*')
.pipe(gulp.dest('public'));
})
gulp.task('imagenes', function(){
gulp
.src('assets/img'+'/**/*')
.pipe(gulp.dest('public/img/'));
})
gulp.task('todoslosjs', function(){
gulp
.src(['assets/js'+'/**/*','!assets/js/main.js'])
.pipe(gulp.dest('public/js/'));
})
gulp.task('scripts', function(){
browserify('assets/js/main.js')
.transform(babel, {presets: ["es2015"]})
.bundle()
.pipe(source('main.js'))
.pipe(rename('mainApp.js'))
.pipe(gulp.dest('public/js/'));
})
/*function compile(watch){
var bundle = watchify(browserify('assets/js/main.js'));
function rebundle(){
bundle
.transform(babel, {presets: ["es2015"]})
.bundle()
.pipe(source('main.js'))
.pipe(rename('mainApp.js'))
.pipe(gulp.dest('public/js/'));
}
if(watch){
bundle.on('update', function(){
console.log('---> Bundling...');
rebundle();
})
}
rebundle();
}
gulp.task('build', function(){
return compile();
})
gulp.task('watch', function(){
return compile(true);
})
*/
gulp.task('default', ['styles','assets','imagenes','todoslosjs','scripts'])