Commit 689306b9820827fe7eb8a9b1245892cfeb282dac
1 parent
f9bebe19ac
Exists in
master
corrijo gulp
Showing
1 changed file
with
0 additions
and
3 deletions
Show diff stats
gulpfile.js
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","focaBotoneraLateral",'+ | ||
47 | '"focaModal","focaModalFactura","focaBusquedaCliente",'+ | ||
48 | '"focaDirectivas","focaModalMoneda","focaModalCotizacion"', ''), | ||
49 | gulp.dest(paths.dist) | 46 | gulp.dest(paths.dist) |
50 | 47 | ||
51 | ] | 48 | ] |
52 | ); | 49 | ); |
53 | }); | 50 | }); |
54 | 51 | ||
55 | gulp.task('clean', function() { | 52 | gulp.task('clean', function() { |
56 | return gulp.src(['tmp', 'dist'], {read: false}) | 53 | return gulp.src(['tmp', 'dist'], {read: false}) |
57 | .pipe(clean()); | 54 | .pipe(clean()); |
58 | }); | 55 | }); |
59 | 56 | ||
60 | gulp.task('pre-commit', function() { | 57 | gulp.task('pre-commit', function() { |
61 | return pump( | 58 | return pump( |
62 | [ | 59 | [ |
63 | gulp.src(paths.srcJS), | 60 | gulp.src(paths.srcJS), |
64 | jshint('.jshintrc'), | 61 | jshint('.jshintrc'), |
65 | jshint.reporter('default'), | 62 | jshint.reporter('default'), |
66 | jshint.reporter('fail') | 63 | jshint.reporter('fail') |
67 | ] | 64 | ] |
68 | ); | 65 | ); |
69 | 66 | ||
70 | gulp.start('uglify'); | 67 | gulp.start('uglify'); |
71 | }); | 68 | }); |
72 | 69 | ||
73 | gulp.task('webserver', function() { | 70 | gulp.task('webserver', function() { |
74 | pump [ | 71 | pump [ |
75 | connect.server({port: 3300, host: '0.0.0.0'}) | 72 | connect.server({port: 3300, host: '0.0.0.0'}) |
76 | ] | 73 | ] |
77 | }); | 74 | }); |
78 | 75 | ||
79 | gulp.task('clean-post-install', function() { | 76 | gulp.task('clean-post-install', function() { |
80 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 77 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', |
81 | 'index.html'], {read: false}) | 78 | 'index.html'], {read: false}) |
82 | .pipe(clean()); | 79 | .pipe(clean()); |
83 | }); | 80 | }); |
84 | 81 | ||
85 | gulp.task('default', ['webserver']); | 82 | gulp.task('default', ['webserver']); |
86 | 83 | ||
87 | gulp.task('watch', function() { | 84 | gulp.task('watch', function() { |
88 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); | 85 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); |
89 | }); | 86 | }); |
90 | 87 |