Fixed build to allow angular.bootstrap (only in production)
diff --git a/xos/core/xoslib/ngXosLib/generator-xos/app/index.js b/xos/core/xoslib/ngXosLib/generator-xos/app/index.js
index 6ddbc6e..15d400b 100755
--- a/xos/core/xoslib/ngXosLib/generator-xos/app/index.js
+++ b/xos/core/xoslib/ngXosLib/generator-xos/app/index.js
@@ -45,20 +45,21 @@
this.fs.copyTpl(
this.templatePath('src/index.html'),
this.destinationPath(`${this.config.get('folder')}/${config.name}/src/index.html`),
- { name: config.name }
+ { name: config.name, fileName: this._fistCharToUpper(config.name) }
);
},
css: function(){
- this.fs.copy(
+ this.fs.copyTpl(
this.templatePath('src/css/dev.css'),
- this.destinationPath(`${this.config.get('folder')}/${config.name}/src/css/dev.css`)
+ this.destinationPath(`${this.config.get('folder')}/${config.name}/src/css/dev.css`),
+ {fileName: this._fistCharToUpper(config.name)}
);
},
mainJs: function(){
this.fs.copyTpl(
this.templatePath('src/js/main.js'),
this.destinationPath(`${this.config.get('folder')}/${config.name}/src/js/main.js`),
- { name: config.name }
+ { name: config.name, fileName: this._fistCharToUpper(config.name) }
);
},
template: function(){
diff --git a/xos/core/xoslib/ngXosLib/generator-xos/app/templates/gulp/build.js b/xos/core/xoslib/ngXosLib/generator-xos/app/templates/gulp/build.js
index 768d8ca..510f18a 100644
--- a/xos/core/xoslib/ngXosLib/generator-xos/app/templates/gulp/build.js
+++ b/xos/core/xoslib/ngXosLib/generator-xos/app/templates/gulp/build.js
@@ -23,6 +23,7 @@
var rename = require('gulp-rename');
var replace = require('gulp-replace');
+var TEMPLATE_FOOTER = '}]);angular.bootstrap(angular.element(\'#xos<%= fileName %>\'), [\'xos.<%= name %>\']);';
module.exports = function(options){
// delete previous builded file
@@ -50,7 +51,8 @@
return gulp.src('./src/templates/*.html')
.pipe(templateCache({
module: 'xos.<%= name %>',
- root: 'templates/'
+ root: 'templates/',
+ templateFooter: TEMPLATE_FOOTER
}))
.pipe(gulp.dest(options.tmp));
});
@@ -61,6 +63,7 @@
// remove dev dependencies from html
.pipe(replace(/<!-- bower:css -->(\n.*)*\n<!-- endbower --><!-- endcss -->/, ''))
.pipe(replace(/<!-- bower:js -->(\n.*)*\n<!-- endbower --><!-- endjs -->/, ''))
+ .pipe(replace(/ng-app=".*"\s/, ''))
// injecting minified files
.pipe(
inject(
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 722eb58..ad7c681 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
@@ -113,7 +113,7 @@
.pipe(gulp.dest(options.src));
});
- gulp.task('js-watch', ['inject'], function(){
+ gulp.task('js-watch', ['injectScript'], function(){
browserSync.reload();
});
diff --git a/xos/core/xoslib/ngXosLib/generator-xos/app/templates/src/css/dev.css b/xos/core/xoslib/ngXosLib/generator-xos/app/templates/src/css/dev.css
index af92e84..d7bc2d9 100644
--- a/xos/core/xoslib/ngXosLib/generator-xos/app/templates/src/css/dev.css
+++ b/xos/core/xoslib/ngXosLib/generator-xos/app/templates/src/css/dev.css
@@ -1,4 +1,4 @@
-[ng-app]{
+#xos<%=fileName%>{
position: absolute;
top: 100px;
left: 200px;
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 bf7f0dd..b271d11 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
@@ -4,7 +4,7 @@
<!-- inject:css -->
<!-- endinject -->
-<div ng-app="xos.<%= name %>">
+<div ng-app="xos.<%= name %>" id="xos<%= fileName %>">
<div ui-view></div>
</div>