Commit 3b51913a000c71517d916b90c772298c3e66a4b6

Authored by Jose Pinto
1 parent b84604bf9e
Exists in master

agrego modulo a gulpfile

Showing 1 changed file with 2 additions and 1 deletions   Show diff stats
1 const templateCache = require('gulp-angular-templatecache'); 1 const templateCache = require('gulp-angular-templatecache');
2 const clean = require('gulp-clean'); 2 const clean = require('gulp-clean');
3 const concat = require('gulp-concat'); 3 const concat = require('gulp-concat');
4 const htmlmin = require('gulp-htmlmin'); 4 const htmlmin = require('gulp-htmlmin');
5 const rename = require('gulp-rename'); 5 const rename = require('gulp-rename');
6 const uglify = require('gulp-uglify'); 6 const uglify = require('gulp-uglify');
7 const gulp = require('gulp'); 7 const gulp = require('gulp');
8 const pump = require('pump'); 8 const pump = require('pump');
9 const jshint = require('gulp-jshint'); 9 const jshint = require('gulp-jshint');
10 const replace = require('gulp-replace'); 10 const replace = require('gulp-replace');
11 const connect = require('gulp-connect'); 11 const connect = require('gulp-connect');
12 12
13 var paths = { 13 var paths = {
14 srcJS: 'src/js/*.js', 14 srcJS: 'src/js/*.js',
15 srcViews: 'src/views/*.html', 15 srcViews: 'src/views/*.html',
16 tmp: 'tmp', 16 tmp: 'tmp',
17 dist: 'dist/' 17 dist: 'dist/'
18 }; 18 };
19 19
20 gulp.task('templates', ['clean'], function() { 20 gulp.task('templates', ['clean'], function() {
21 return pump( 21 return pump(
22 [ 22 [
23 gulp.src(paths.srcViews), 23 gulp.src(paths.srcViews),
24 htmlmin(), 24 htmlmin(),
25 templateCache('views.js', { 25 templateCache('views.js', {
26 module: 'focaCrearCobranza', 26 module: 'focaCrearCobranza',
27 root: '' 27 root: ''
28 }), 28 }),
29 gulp.dest(paths.tmp) 29 gulp.dest(paths.tmp)
30 ] 30 ]
31 ); 31 );
32 }); 32 });
33 33
34 gulp.task('uglify', ['templates'], function() { 34 gulp.task('uglify', ['templates'], function() {
35 return pump( 35 return pump(
36 [ 36 [
37 gulp.src([ 37 gulp.src([
38 paths.srcJS, 38 paths.srcJS,
39 'tmp/views.js' 39 'tmp/views.js'
40 ]), 40 ]),
41 concat('foca-crear-cobranza.js'), 41 concat('foca-crear-cobranza.js'),
42 replace('src/views/', ''), 42 replace('src/views/', ''),
43 gulp.dest(paths.tmp), 43 gulp.dest(paths.tmp),
44 rename('foca-crear-cobranza.min.js'), 44 rename('foca-crear-cobranza.min.js'),
45 uglify(), 45 uglify(),
46 replace('"ngRoute","ui.bootstrap","focaModal","focaModalFactura","focaBusquedaCliente",'+ 46 replace('"ngRoute","ui.bootstrap","focaBotoneraLateral",'+
47 '"focaModal","focaModalFactura","focaBusquedaCliente",'+
47 '"focaDirectivas","focaModalMoneda","focaModalCotizacion"', ''), 48 '"focaDirectivas","focaModalMoneda","focaModalCotizacion"', ''),
48 gulp.dest(paths.dist) 49 gulp.dest(paths.dist)
49 50
50 ] 51 ]
51 ); 52 );
52 }); 53 });
53 54
54 gulp.task('clean', function() { 55 gulp.task('clean', function() {
55 return gulp.src(['tmp', 'dist'], {read: false}) 56 return gulp.src(['tmp', 'dist'], {read: false})
56 .pipe(clean()); 57 .pipe(clean());
57 }); 58 });
58 59
59 gulp.task('pre-commit', function() { 60 gulp.task('pre-commit', function() {
60 return pump( 61 return pump(
61 [ 62 [
62 gulp.src(paths.srcJS), 63 gulp.src(paths.srcJS),
63 jshint('.jshintrc'), 64 jshint('.jshintrc'),
64 jshint.reporter('default'), 65 jshint.reporter('default'),
65 jshint.reporter('fail') 66 jshint.reporter('fail')
66 ] 67 ]
67 ); 68 );
68 69
69 gulp.start('uglify'); 70 gulp.start('uglify');
70 }); 71 });
71 72
72 gulp.task('webserver', function() { 73 gulp.task('webserver', function() {
73 pump [ 74 pump [
74 connect.server({port: 3300, host: '0.0.0.0'}) 75 connect.server({port: 3300, host: '0.0.0.0'})
75 ] 76 ]
76 }); 77 });
77 78
78 gulp.task('clean-post-install', function() { 79 gulp.task('clean-post-install', function() {
79 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', 80 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js',
80 'index.html'], {read: false}) 81 'index.html'], {read: false})
81 .pipe(clean()); 82 .pipe(clean());
82 }); 83 });
83 84
84 gulp.task('default', ['webserver']); 85 gulp.task('default', ['webserver']);
85 86
86 gulp.task('watch', function() { 87 gulp.task('watch', function() {
87 gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); 88 gulp.watch([paths.srcJS, paths.srcViews], ['uglify']);
88 }); 89 });
89 90