Reloading broser when helpers change
diff --git a/views/ngXosViews/sampleView/gulp/server.js b/views/ngXosViews/sampleView/gulp/server.js
index fe55ce3..3c6a8e3 100644
--- a/views/ngXosViews/sampleView/gulp/server.js
+++ b/views/ngXosViews/sampleView/gulp/server.js
@@ -3,6 +3,7 @@
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var inject = require('gulp-inject');
+var es = require('event-stream');
var runSequence = require('run-sequence');
var angularFilesort = require('gulp-angular-filesort');
var babel = require('gulp-babel');
@@ -10,6 +11,7 @@
var httpProxy = require('http-proxy');
var del = require('del');
var sass = require('gulp-sass');
+var debug = require('gulp-debug');
const environment = process.env.NODE_ENV;
@@ -60,7 +62,6 @@
// req.url.indexOf('/hpcapi/') !== -1 ||
req.url.indexOf('/api/') !== -1
){
- console.log('proxyed' + req.url);
if(conf.xoscsrftoken && conf.xossessionid){
req.headers.cookie = `xoscsrftoken=${conf.xoscsrftoken}; xossessionid=${conf.xossessionid}`;
req.headers['x-csrftoken'] = conf.xoscsrftoken;
@@ -84,6 +85,11 @@
gulp.watch(options.css + '**/*.css', function(){
browserSync.reload();
});
+
+ gulp.watch(options.helpers + 'ngXosHelpers.js', function(){
+ browserSync.reload();
+ });
+
gulp.watch(`${options.sass}/**/*.scss`, ['sass'], function(){
browserSync.reload();
});
@@ -103,16 +109,40 @@
.pipe(gulp.dest(options.tmp));
});
+ // // inject sourceMap
+ // gulp.task('injectMaps', function(){
+ // return gulp.src(options.src + 'index.html')
+ // .pipe(
+ // inject(
+ // gulp.src([
+ // options.helpersSourceMaps + '**/*.js.map'
+ // ], {read: false}).pipe(debug()),
+ // {
+ // starttag: '<!-- inject:maps -->',
+ // // ignorePath: [options.src, '/../../ngXosLib']
+ // }
+ // )
+ // )
+ // .pipe(gulp.dest(options.src));
+ // });
+
// inject scripts
gulp.task('injectScript', ['cleanTmp', 'babel'], function(){
+
+ var appScripts = gulp.src([
+ options.tmp + '**/*.js',
+ options.helpers + 'ngXosHelpers.js'
+ ])
+ .pipe(angularFilesort()).pipe(debug());
+
+ var helpersSourceMaps = gulp.src([
+ options.helpersSourceMaps + '**/*.js.map'
+ ]).pipe(debug());
+
return gulp.src(options.src + 'index.html')
.pipe(
inject(
- gulp.src([
- options.tmp + '**/*.js',
- options.helpers + 'ngXosHelpers.js'
- ])
- .pipe(angularFilesort()),
+ es.merge(appScripts, helpersSourceMaps),
{
ignorePath: [options.src, '/../../ngXosLib']
}
diff --git a/views/ngXosViews/sampleView/gulpfile.js b/views/ngXosViews/sampleView/gulpfile.js
index 08df554..8b50345 100644
--- a/views/ngXosViews/sampleView/gulpfile.js
+++ b/views/ngXosViews/sampleView/gulpfile.js
@@ -12,6 +12,7 @@
dist: 'dist/',
api: '../../ngXosLib/api/',
helpers: '../../../xos/core/xoslib/static/js/vendor/',
+ helpersSourceMaps: '../../ngXosLib/xosHelpers/.tmp/maps/',
static: '../../../xos/core/xoslib/static/', // this is the django static folder
dashboards: '../../../xos/core/xoslib/dashboards/' // this is the django html folder
};
diff --git a/views/ngXosViews/sampleView/package.json b/views/ngXosViews/sampleView/package.json
index 0ffe32c..e92f937 100644
--- a/views/ngXosViews/sampleView/package.json
+++ b/views/ngXosViews/sampleView/package.json
@@ -28,12 +28,14 @@
"easy-mocker": "^1.2.0",
"eslint": "^1.8.0",
"eslint-plugin-angular": "linkmesrl/eslint-plugin-angular",
+ "event-stream": "^3.3.2",
"gulp": "^3.9.0",
"gulp-angular-filesort": "^1.1.1",
"gulp-angular-templatecache": "^1.8.0",
"gulp-babel": "^5.3.0",
"gulp-concat": "^2.6.0",
"gulp-concat-util": "^0.5.5",
+ "gulp-debug": "^2.1.2",
"gulp-eslint": "^1.0.0",
"gulp-inject": "^3.0.0",
"gulp-minify-html": "^1.0.4",
diff --git a/views/ngXosViews/sampleView/src/index.html b/views/ngXosViews/sampleView/src/index.html
index 5779012..d04fc3b 100644
--- a/views/ngXosViews/sampleView/src/index.html
+++ b/views/ngXosViews/sampleView/src/index.html
@@ -24,3 +24,6 @@
<script src="/../../../xos/core/xoslib/static/js/vendor/ngXosHelpers.js"></script>
<script src="/.tmp/main.js"></script>
<!-- endinject -->
+
+<!-- inject:map -->
+<!-- endinject -->
\ No newline at end of file