From 31f4cf02534956136d8c58e24e56aaf1f81a1bd2 Mon Sep 17 00:00:00 2001 From: Henry Megarry Date: Thu, 25 May 2017 12:20:32 -0500 Subject: [PATCH] adding url context path to html templates (#814) --- docs/quickstart/index.rst | 2 +- gulp/build.js | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/quickstart/index.rst b/docs/quickstart/index.rst index 446b9461..6718bf82 100644 --- a/docs/quickstart/index.rst +++ b/docs/quickstart/index.rst @@ -89,7 +89,7 @@ And then run: .. note:: This command will install npm dependencies as well as compile static assets. -You may also run with the urlContextPath variable set. If this is set it will add the desired context path for subsequent calls back to lemur. +You may also run with the urlContextPath variable set. If this is set it will add the desired context path for subsequent calls back to lemur. This will only edit the front end code for calls back to the server, you will have to make sure the server knows about these routes. :: Example: diff --git a/gulp/build.js b/gulp/build.js index bf4de732..eed59503 100644 --- a/gulp/build.js +++ b/gulp/build.js @@ -232,10 +232,16 @@ gulp.task('package:strip', function () { gulp.task('addUrlContextPath',['addUrlContextPath:revreplace'], function(){ var urlContextPathExists = argv.urlContextPath ? true : false; - return gulp.src('lemur/static/dist/scripts/main*.js') - .pipe(gulpif(urlContextPathExists, replace('api/', argv.urlContextPath + '/api/'))) - .pipe(gulpif(urlContextPathExists, replace('angular/', argv.urlContextPath + '/angular/'))) - .pipe(gulp.dest('lemur/static/dist/scripts')) + ['lemur/static/dist/scripts/main*.js', + 'lemur/static/dist/angular/**/*.html'] + .forEach(function(file){ + return gulp.src(file) + .pipe(gulpif(urlContextPathExists, replace('api/', argv.urlContextPath + '/api/'))) + .pipe(gulpif(urlContextPathExists, replace('angular/', argv.urlContextPath + '/angular/'))) + .pipe(gulp.dest(function(file){ + return file.base; + })) + }) }); gulp.task('addUrlContextPath:revision', function(){