Fixed livereload and inject for js files
diff --git a/xos/core/xoslib/ngXosLib/generator-xos/app/templates/.gitignore b/xos/core/xoslib/ngXosLib/generator-xos/app/templates/.gitignore
index bccda71..567aee4 100644
--- a/xos/core/xoslib/ngXosLib/generator-xos/app/templates/.gitignore
+++ b/xos/core/xoslib/ngXosLib/generator-xos/app/templates/.gitignore
@@ -2,4 +2,5 @@
src/vendor
.tmp
node_modules
-npm-debug.log
\ No newline at end of file
+npm-debug.log
+dist/
\ No newline at end of file
diff --git a/xos/core/xoslib/ngXosLib/generator-xos/app/templates/gulp/server.js b/xos/core/xoslib/ngXosLib/generator-xos/app/templates/gulp/server.js
index 50f2371..2949e36 100644
--- a/xos/core/xoslib/ngXosLib/generator-xos/app/templates/gulp/server.js
+++ b/xos/core/xoslib/ngXosLib/generator-xos/app/templates/gulp/server.js
@@ -8,6 +8,7 @@
var babel = require('gulp-babel');
var wiredep = require('wiredep').stream;
var httpProxy = require('http-proxy');
+var del = require('del');
var proxy = httpProxy.createProxyServer({
target: 'http://0.0.0.0:9999'
@@ -27,7 +28,14 @@
// open in browser with sync and proxy to 0.0.0.0
gulp.task('browser', function() {
browserSync.init({
- reloadDelay: 500,
+ // reloadDelay: 500,
+ // logLevel: 'debug',
+ // logConnections: true,
+ snippetOptions: {
+ rule: {
+ match: /<!-- browserSync -->/i
+ }
+ },
server: {
baseDir: options.src,
routes: {
@@ -55,7 +63,7 @@
});
// inject scripts
- gulp.task('inject', ['babel'],function(){
+ gulp.task('inject', ['cleanTmp', 'babel'],function(){
return gulp.src(options.src + 'index.html')
.pipe(
inject(
@@ -79,7 +87,13 @@
.pipe(gulp.dest(options.src));
});
- gulp.task('js-watch', ['babel'], browserSync.reload);
+ gulp.task('js-watch', ['inject'], function(){
+ browserSync.reload();
+ });
+
+ gulp.task('cleanTmp', function(){
+ return del([options.tmp + '**/*']);
+ });
gulp.task('serve', function() {
runSequence(
diff --git a/xos/core/xoslib/ngXosLib/generator-xos/app/templates/src/index.html b/xos/core/xoslib/ngXosLib/generator-xos/app/templates/src/index.html
index 317ac0e..21404f1 100644
--- a/xos/core/xoslib/ngXosLib/generator-xos/app/templates/src/index.html
+++ b/xos/core/xoslib/ngXosLib/generator-xos/app/templates/src/index.html
@@ -1,3 +1,4 @@
+<!-- browserSync -->
<!-- bower:css -->
<!-- endbower -->
diff --git a/xos/core/xoslib/ngXosLib/generator-xos/app/templates/src/js/main.js b/xos/core/xoslib/ngXosLib/generator-xos/app/templates/src/js/main.js
index 4ae87f5..728394a 100644
--- a/xos/core/xoslib/ngXosLib/generator-xos/app/templates/src/js/main.js
+++ b/xos/core/xoslib/ngXosLib/generator-xos/app/templates/src/js/main.js
@@ -5,6 +5,8 @@
// - Add Cache
// - Refactor routing with ui.router and child views (share the navigation and header)
+'use strict';
+
angular.module('xos.<%= name %>', [
'ngResource',
'ngRoute',