-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathgulpfile.js
executable file
·202 lines (173 loc) · 5.73 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var uglify = require('gulp-uglify');
var sass = require('gulp-sass')(require('sass'));
var plumber = require('gulp-plumber');
var concat = require('gulp-concat');
var SRC = './src/js/*.js';
var rename = require('gulp-rename');
const gulpIF = require('gulp-if');
var generalCompressOptions = {
compress: {
drop_console: true
}
};
const ponchoMinList = [
'./src/js/color/src/js/color-definitions.js',
'./src/js/color/src/js/color.js',
'./src/js/color/src/js/color-variations.js',
'./src/js/utils/connect.js',
'./src/js/utils/string.js',
'./src/js/utils/html.js',
'./src/js/utils/document.js',
'./src/js/utils/collections.js',
'./src/js/poncho-table/poncho-table.js',
'./src/js/poncho-agenda/src/js/poncho-agenda.js',
'./src/js/poncho-table/poncho-table-dependant.js',
'./src/js/utils/popover.js',
'./src/js/poncho-ubicacion/poncho-ubicacion.js',
'./src/js/poncho-charts/poncho-charts.js',
'./src/js/utils/gapi-legacy.js',
'./src/js/poncho-map/src/js/poncho-map.js',
'./src/js/poncho-map/src/js/poncho-map-filter.js',
'./src/js/poncho-map/src/js/poncho-map-search.js',
'./src/js/poncho-map-provinces/src/js/poncho-map-provinces.js',
// './src/js/poncho-map-provinces/src/js/poncho-map-provinces-contenidos.js',
'./src/js/gapi-sheet-data/gapi-sheet-data.js',
'./src/js/translate-html/translate-html.js'
];
gulp.task('poncho', function(){
return gulp.src(ponchoMinList)
.pipe(concat('poncho.js', {'newLine':'\n\n'}))
// .pipe(babel())
.pipe(gulp.dest('dist/js/'));
});
/**
* Compila y minifica los archivs JS en poncho.min.js
*/
gulp.task('ponchoMapProvincesContenidos', function(){
return gulp.src(['./src/js/poncho-map-provinces/src/js/poncho-map-provinces-contenidos.js'])
.pipe(uglify(generalCompressOptions))
.pipe(gulp.dest('./src/js/poncho-map-provinces/dist/js/'));
});
/**
* Compila y minifica los archivs JS en poncho.min.js
*/
gulp.task('ponchomin', function(){
return gulp.src(ponchoMinList)
.pipe(concat('poncho.min.js'))
.pipe(uglify(generalCompressOptions))
.pipe(gulp.dest('dist/js/'));
});
gulp.task('jshint', function(){
return gulp.src([SRC], {"allowEmpty": true})
.pipe(plumber())
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
/**
* Minifica los siguientes componentes
* — Mapa de argentina en SVG
* — Extensiones showdown markdown
* — omponente para controlar las migas de pan en Argentina.gob.ar
*/
gulp.task('compress', function () {
return gulp.src([
// './src/js/showdown-extensions/dist/showdown-extensions.js',
'./src/js/mapa-argentina/mapa-argentina.js',
'./src/js/device-breadcrumb/src/js/device-breadcrumb.js',
'./src/js/national-holidays/src/js/national-holidays.js',
'./src/js/device-panel-menu/device-panel-menu.js'
])
.pipe(uglify(generalCompressOptions))
.pipe(gulp.dest('./dist/js/'));
});
// MARKDOWN
const markdownFiles = [
"./src/js/showdown-extensions/src/utils.js",
"./src/js/showdown-extensions/src/alert.js",
"./src/js/showdown-extensions/src/image.js",
"./src/js/showdown-extensions/src/table.js",
"./src/js/showdown-extensions/src/button.js",
"./src/js/showdown-extensions/src/details.js",
"./src/js/showdown-extensions/src/eje.js",
"./src/js/showdown-extensions/src/numbers.js",
"./src/js/showdown-extensions/src/target.js",
"./src/js/showdown-extensions/src/video.js"
]
/**
* Minifica los siguientes componentes
* — Mapa de argentina en SVG
* — Extensiones showdown markdown
* — omponente para controlar las migas de pan en Argentina.gob.ar
*/
gulp.task('js-dist-showdown-extensions', function () {
return gulp.src(markdownFiles)
.pipe(concat('showdown-extensions.js'))
.pipe(uglify(generalCompressOptions))
.pipe(gulp.dest('./src/js/showdown-extensions/dist/'));
});
// Envia el archivo a main dist
gulp.task('js-showdown-extensions', function () {
return gulp.src(markdownFiles)
.pipe(concat('showdown-extensions.js'))
.pipe(uglify(generalCompressOptions))
.pipe(gulp.dest('./dist/js/'));
});
/**
* SASS
*/
gulp.task('sass', function(){
return gulp.src([
'./src/scss/*.scss'
])
// .pipe(sass())
.pipe(sass.sync({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(gulpIF(function(file){return file.path.match('poncho.css')}, rename('poncho.min.css')))
.pipe(gulp.dest('./dist/css'))
});
/**
* Compila los archivso SASS
*/
gulp.task('sass_poncho', function(){
return gulp.src([
'./src/scss/poncho.scss',
'./src/js/device-breadcrumb/src/scss/device-breadcrumb.scss',
])
.pipe(sass.sync({outputStyle: 'compressed'}).on('error', sass.logError))
// .pipe(sass())
.pipe(gulp.dest('./dist/css'))
});
/**
* Compila los archivso SASS
*/
gulp.task('sass_poncho-map', function(){
return gulp.src([
'./src/scss/poncho-map.scss'
])
.pipe(sass.sync({outputStyle: 'compressed'}).on('error', sass.logError))
// .pipe(sass())
.pipe(gulp.dest('./dist/css'))
});
/**
* Poncho table
*/
gulp.task('sass_poncho-table', function(){
return gulp.src([
'./src/js/poncho-table/src/scss/poncho-table-1.1.scss'
])
.pipe(sass.sync({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(gulp.dest('./dist/css'))
});
gulp.task('default', gulp.series(
'ponchoMapProvincesContenidos',
'sass',
'sass_poncho',
'compress',
'poncho',
'ponchomin',
"sass_poncho-map",
"sass_poncho-table",
"js-showdown-extensions",
"js-dist-showdown-extensions"
))