Commit 71ce284bd15fa011917ff6e3dc43e08d6663917d

Authored by Eric Fernandez
1 parent 3c79411c13
Exists in master

agrego instancia de gulp-replace

quito inyecciones para min.js
Showing 1 changed file with 3 additions and 0 deletions   Show diff stats
1 const templateCache = require('gulp-angular-templatecache'); 1 const templateCache = require('gulp-angular-templatecache');
2 const concat = require('gulp-concat'); 2 const concat = require('gulp-concat');
3 const clean = require('gulp-clean'); 3 const clean = require('gulp-clean');
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-es').default; 6 const uglify = require('gulp-uglify-es').default;
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 11
11 var paths = { 12 var paths = {
12 srcJS: 'src/js/*.js', 13 srcJS: 'src/js/*.js',
13 srcViews: 'src/views/*.html', 14 srcViews: 'src/views/*.html',
14 tmp: 'tmp', 15 tmp: 'tmp',
15 dist: 'dist/' 16 dist: 'dist/'
16 }; 17 };
17 18
18 gulp.task('templates', function() { 19 gulp.task('templates', function() {
19 return pump( 20 return pump(
20 [ 21 [
21 gulp.src(paths.srcViews), 22 gulp.src(paths.srcViews),
22 htmlmin(), 23 htmlmin(),
23 templateCache('views.js', { 24 templateCache('views.js', {
24 module: 'focaLogin', 25 module: 'focaLogin',
25 root: '' 26 root: ''
26 }), 27 }),
27 gulp.dest(paths.tmp) 28 gulp.dest(paths.tmp)
28 ] 29 ]
29 ); 30 );
30 }); 31 });
31 32
32 gulp.task('uglify', ['templates'], function() { 33 gulp.task('uglify', ['templates'], function() {
33 return pump( 34 return pump(
34 [ 35 [
35 gulp.src([ 36 gulp.src([
36 paths.srcJS, 37 paths.srcJS,
37 'tmp/views.js' 38 'tmp/views.js'
38 ]), 39 ]),
39 concat('foca-login.js'), 40 concat('foca-login.js'),
41 replace("['ngRoute', 'ngCookies']",'[]'),
42 replace('src/views/', ''),
40 gulp.dest(paths.tmp), 43 gulp.dest(paths.tmp),
41 rename('foca-login.min.js'), 44 rename('foca-login.min.js'),
42 uglify(), 45 uglify(),
43 gulp.dest(paths.dist) 46 gulp.dest(paths.dist)
44 ] 47 ]
45 ); 48 );
46 }); 49 });
47 50
48 gulp.task('clean', function() { 51 gulp.task('clean', function() {
49 return gulp.src(['tmp', 'dist'], {read: false}) 52 return gulp.src(['tmp', 'dist'], {read: false})
50 .pipe(clean()); 53 .pipe(clean());
51 }); 54 });
52 55
53 gulp.task('pre-commit', function() { 56 gulp.task('pre-commit', function() {
54 pump( 57 pump(
55 [ 58 [
56 gulp.src(paths.srcJS), 59 gulp.src(paths.srcJS),
57 jshint('.jshintrc'), 60 jshint('.jshintrc'),
58 jshint.reporter('default'), 61 jshint.reporter('default'),
59 jshint.reporter('fail') 62 jshint.reporter('fail')
60 ] 63 ]
61 ); 64 );
62 }); 65 });
63 66
64 gulp.task('clean-post-install', function() { 67 gulp.task('clean-post-install', function() {
65 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', 68 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js',
66 'index.html'], {read: false}) 69 'index.html'], {read: false})
67 .pipe(clean()); 70 .pipe(clean());
68 }); 71 });
69 72
70 gulp.task('compile', ['templates', 'uglify']); 73 gulp.task('compile', ['templates', 'uglify']);
71 74
72 gulp.task('webserver', function() { 75 gulp.task('webserver', function() {
73 pump [ 76 pump [
74 connect.server({port: 3000}) 77 connect.server({port: 3000})
75 ] 78 ]
76 }); 79 });
77 80
78 gulp.task('default', ['webserver']); 81 gulp.task('default', ['webserver']);
79 82