Commit 80c8a48cb27eca7537ef47d42e2405a6478c7ebe

Authored by Eric Fernandez
1 parent e064fbb6cc
Exists in master

agrego instancia de gulp-replace

agrego tareas para elminar archivos postinstall
Showing 1 changed file with 18 additions and 1 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: 'focaAbmPreciosCondiciones', 25 module: 'focaAbmPreciosCondiciones',
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-abm-precios-condiciones.js'), 40 concat('foca-abm-precios-condiciones.js'),
41 replace('src/views/', ''),
42 replace("['ngRoute', 'ui.bootstrap']", '[]'),
40 gulp.dest(paths.tmp), 43 gulp.dest(paths.tmp),
41 rename('foca-abm-precios-condiciones.min.js'), 44 rename('foca-abm-precios-condiciones.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 });
66
67 gulp.task('clean-post-install', function(){
68 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js',
69 'index.html'], {read: false})
70 .pipe(clean());
71 });
72
73 gulp.task('webserver', function() {
74 pump [
75 connect.server({port: 3000})
76 ]
77 });
78
79 gulp.task('default', ['webserver']);
63 80