Commit 9e492b1303a95d7a06338d2110979a32e18058c7

Authored by Eric Fernandez
1 parent daea73b836
Exists in master

cambio gulp

Showing 1 changed file with 2 additions and 2 deletions   Show diff stats
1 const gulp = require('gulp'); 1 const gulp = require('gulp');
2 const sass = require('gulp-sass'); 2 const sass = require('gulp-sass');
3 const concat = require('gulp-concat'); 3 const concat = require('gulp-concat');
4 const rename = require('gulp-rename'); 4 const rename = require('gulp-rename');
5 const uglify = require('gulp-uglify'); 5 const uglify = require('gulp-uglify');
6 const pump = require('pump'); 6 const pump = require('pump');
7 const jshint = require('gulp-jshint'); 7 const jshint = require('gulp-jshint');
8 const replace = require('gulp-replace'); 8 const replace = require('gulp-replace');
9 const connect = require('gulp-connect'); 9 const connect = require('gulp-connect');
10 const watch = require('gulp-watch'); 10 const watch = require('gulp-watch');
11 11
12 var paths = { 12 var paths = {
13 srcHTML : 'src/views/*.html', 13 srcHTML : 'src/views/*.html',
14 srcJS : 'src/js/*.js', 14 srcJS : 'src/js/*.js',
15 confJS : 'src/etc/develop.js', 15 confJS : 'src/etc/develop.js',
16 dist : 'dist/', 16 dist : 'dist/',
17 distHTML : 'dist/views/' 17 distHTML : 'dist/views/'
18 }; 18 };
19 19
20 gulp.task('uglify', function() { 20 gulp.task('uglify', function() {
21 pump( 21 pump(
22 [ 22 [
23 gulp.src([paths.srcJS, paths.confJS]), 23 gulp.src([paths.srcJS, paths.confJS]),
24 concat('wrapper-demo.js'), 24 concat('wrapper-demo.js'),
25 replace('/src/', '/dist/'), 25 replace('/src/', '/dist/'),
26 gulp.dest(paths.dist), 26 gulp.dest(paths.dist),
27 rename('wrapper-demo.min.js'), 27 rename('wrapper-demo.min.js'),
28 uglify(), 28 uglify(),
29 gulp.dest(paths.dist) 29 gulp.dest(paths.dist)
30 ] 30 ]
31 ); 31 );
32 }); 32 });
33 33
34 gulp.task('html', function() { 34 gulp.task('html', function() {
35 pump([ 35 pump([
36 gulp.src('index.html'), 36 gulp.src('index.html'),
37 replace(/\<!\-\- BUILD \-\-\>.*\<!\-\- \/BUILD \-\-\>/sgm, '<script src="wrapper-demo.min.js"></script>'), 37 replace(/\<!\-\- BUILD \-\-\>.*\<!\-\- \/BUILD \-\-\>/sgm, '<script src="wrapper-demo.min.js"></script>'),
38 gulp.dest(paths.dist) 38 gulp.dest(paths.dist)
39 ]); 39 ]);
40 pump([ 40 pump([
41 gulp.src(paths.srcHTML), 41 gulp.src(paths.srcHTML),
42 gulp.dest(paths.distHTML) 42 gulp.dest(paths.distHTML)
43 ]); 43 ]);
44 }) 44 })
45 45
46 gulp.task('sass', function() { 46 gulp.task('sass', function() {
47 return gulp.src('src/sass/*.scss') 47 return gulp.src('src/sass/*.scss')
48 .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError)) 48 .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
49 .pipe(gulp.dest('css')); 49 .pipe(gulp.dest('css'));
50 }); 50 });
51 51
52 gulp.task('pre-install', function() { 52 gulp.task('pre-install', function() {
53 pump([ 53 pump([
54 gulp.src('package.json'), 54 gulp.src('package.json'),
55 replace('debonline.dyndns.org', 'git.focasoftware.com'), 55 replace('ssh://git@debonline.dyndns.org:', 'http://git.focasoftware.com/'),
56 gulp.dest('') 56 gulp.dest('')
57 ]); 57 ]);
58 }) 58 })
59 59
60 gulp.task('post-install', function() { 60 gulp.task('post-install', function() {
61 pump([ 61 pump([
62 gulp.src('package.json'), 62 gulp.src('package.json'),
63 replace('git.focasoftware.com', 'debonline.dyndns.org'), 63 replace('http://git.focasoftware.com/', 'ssh://git@debonline.dyndns.org:'),
64 gulp.dest('') 64 gulp.dest('')
65 ]); 65 ]);
66 }) 66 })
67 67
68 gulp.task('pre-commit', function() { 68 gulp.task('pre-commit', function() {
69 pump( 69 pump(
70 [ 70 [
71 gulp.src(paths.srcJS), 71 gulp.src(paths.srcJS),
72 jshint('.jshintrc'), 72 jshint('.jshintrc'),
73 jshint.reporter('default'), 73 jshint.reporter('default'),
74 jshint.reporter('fail') 74 jshint.reporter('fail')
75 ] 75 ]
76 ); 76 );
77 gulp.start('uglify'); 77 gulp.start('uglify');
78 gulp.start('sass'); 78 gulp.start('sass');
79 }); 79 });
80 80
81 gulp.task('webserver', function() { 81 gulp.task('webserver', function() {
82 pump [ 82 pump [
83 connect.server( 83 connect.server(
84 { 84 {
85 port: 8086, 85 port: 8086,
86 host: '0.0.0.0', 86 host: '0.0.0.0',
87 livereload: true 87 livereload: true
88 } 88 }
89 ) 89 )
90 ] 90 ]
91 }); 91 });
92 92
93 gulp.task('watch', function() { 93 gulp.task('watch', function() {
94 gulp.watch([paths.srcJS], ['uglify']); 94 gulp.watch([paths.srcJS], ['uglify']);
95 gulp.watch('src/sass/*.scss', ['sass']); 95 gulp.watch('src/sass/*.scss', ['sass']);
96 }) 96 })
97 97
98 gulp.task('reload'), function() { 98 gulp.task('reload'), function() {
99 connect.reload(); 99 connect.reload();
100 } 100 }
101 101
102 gulp.task('livereload', function() { 102 gulp.task('livereload', function() {
103 gulp.watch('css/*.css', ['reload']); 103 gulp.watch('css/*.css', ['reload']);
104 gulp.watch('js/dist/*.js', ['reload']); 104 gulp.watch('js/dist/*.js', ['reload']);
105 gulp.watch('vistas/**/*.html', ['reload']); 105 gulp.watch('vistas/**/*.html', ['reload']);
106 gulp.watch('index.html', ['reload']); 106 gulp.watch('index.html', ['reload']);
107 }); 107 });
108 108
109 gulp.task('default', ['webserver', 'livereload', 'watch']); 109 gulp.task('default', ['webserver', 'livereload', 'watch']);
110 110