Concatenar rutas con Gulp

This commit is contained in:
Juan Ferrer Toribio 2016-10-10 11:15:05 +02:00
parent 301588e0ed
commit d9bfd1b579
3 changed files with 24 additions and 5 deletions

View File

@ -0,0 +1,8 @@
[{
url: '/provider',
state: 'provider',
template: '<provider-index></provider-index>',
module: 'crud',
description: '',
image: '',
}]

View File

@ -1,12 +1,19 @@
var gulp = require ('gulp'); var gulp = require ('gulp');
var concat = require ('gulp-concat'); var concat = require ('gulp-concat');
var insert = require ('gulp-insert');
var babel = require ('gulp-babel'); var babel = require ('gulp-babel');
var wrap = require("gulp-wrap");
var template = '"<%=file.path%>": <%=contents%>';
gulp.task ('default', function () gulp.task ('default', function ()
{ {
var js = gulp.src ('./@salix/crud/**/routes.js') var js = gulp.src ('./@salix/**/routes.js')
.pipe (concat ('salix.routes.js')) .pipe (wrap (template))
.pipe (concat ('salix.routes.js', {newLine: ','}))
.pipe (insert.prepend ('var routes = {'))
.pipe (insert.append ('};'))
.pipe (babel ({presets: ['es2015']})) .pipe (babel ({presets: ['es2015']}))
.pipe (gulp.dest ('./build/private')); .pipe (gulp.dest ('./build/private'));
}); });

View File

@ -19,16 +19,18 @@
"babel-core": "*", "babel-core": "*",
"babel-loader": "*", "babel-loader": "*",
"babel-preset-es2015": "*", "babel-preset-es2015": "*",
"cors": "^2.8.1",
"css-loader": "^0.25.0", "css-loader": "^0.25.0",
"eslint": "^3.7.1", "eslint": "^3.7.1",
"eslint-config-angular": "^0.5.0", "eslint-config-angular": "^0.5.0",
"eslint-config-google": "^0.6.0", "eslint-config-google": "^0.6.0",
"eslint-plugin-angular": "^1.4.1", "eslint-plugin-angular": "^1.4.1",
"gulp": "^3.9.1", "gulp": "^3.9.1",
"pre-commit": "^1.1.3",
"cors": "^2.8.1",
"gulp-babel": "^6.1.2", "gulp-babel": "^6.1.2",
"gulp-concat": "^2.6.0", "gulp-concat": "^2.6.0",
"gulp-insert": "^0.5.0",
"gulp-wrap": "^0.13.0",
"pre-commit": "^1.1.3",
"raw-loader": "*", "raw-loader": "*",
"style-loader": "^0.13.1", "style-loader": "^0.13.1",
"webpack": "*", "webpack": "*",
@ -41,5 +43,7 @@
"gulp": "gulp", "gulp": "gulp",
"express": "node server.js" "express": "node server.js"
}, },
"pre-commit": [ "lint" ] "pre-commit": [
"lint"
]
} }