chore(demos): add option to use a custom demo template

This commit is contained in:
Drew Rygh
2015-12-11 11:33:08 -06:00
parent 76122446d4
commit 84cb47dae7
3 changed files with 38 additions and 1 deletions

33
demos/config/index.html Normal file
View File

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<!-- https://www.chromium.org/developers/design-documents/chromium-graphics/how-to-get-gpu-rasterization -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<script type="text/javascript" src="config-demo.js"></script>
<link href="../../css/ionic.css" rel="stylesheet">
</head>
<body>
<ion-app>
<ion-loading-icon></ion-loading-icon>
</ion-app>
<script src="bundle.js"></script>
<!-- <script src="../../js/ionic.bundle.js"></script>
<script>
System.config({
"paths": {
"*": "*.js",
"ionic/*": "ionic/*",
"angular2/*": "angular2/*",
"rx": "rx"
}
})
System.import("index");
</script> -->
</body>
</html>

View File

@ -27,7 +27,7 @@ export class TabPage {
export class InitialPage { export class InitialPage {
constructor(platform: Platform) { constructor(platform: Platform) {
this.platform = platform; this.platform = platform;
if (window.localStorage.getItem('configDemo') !== "{}") { if (window.localStorage.getItem('configDemo') !== null) {
debugger; debugger;
this.config = JSON.parse(window.localStorage.getItem('configDemo')); this.config = JSON.parse(window.localStorage.getItem('configDemo'));
} }
@ -48,6 +48,7 @@ export class InitialPage {
load() { load() {
window.localStorage.setItem('configDemo', JSON.stringify(this.config)); window.localStorage.setItem('configDemo', JSON.stringify(this.config));
console.log('saving', this.config);
window.location.reload(); window.location.reload();
} }
} }

View File

@ -475,8 +475,11 @@ gulp.task('build.demos', function(){
function createIndexHTML() { function createIndexHTML() {
return through2.obj(function(file, enc, next) { return through2.obj(function(file, enc, next) {
var indexTemplate = baseIndexTemplate; var indexTemplate = baseIndexTemplate;
var customTemplateFp = file.path.split('/').slice(0, -1).join('/') + '/index.html';
if (file.path.indexOf('component-docs') > -1) { if (file.path.indexOf('component-docs') > -1) {
indexTemplate = docsIndexTemplate; indexTemplate = docsIndexTemplate;
} else if (fs.existsSync(customTemplateFp)) {
indexTemplate = _.template(fs.readFileSync(customTemplateFp))();
} }
this.push(new VinylFile({ this.push(new VinylFile({
base: file.base, base: file.base,