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