@spin-io/sdk-app-compiler
Advanced tools
Comparing version
@@ -150,5 +150,7 @@ 'use strict'; | ||
key: 'getTemplate', | ||
value: function getTemplate(css, html, debug, additionalScripts) { | ||
value: function getTemplate(css, html, debug) { | ||
var name = this.name, | ||
externals = this.externals; | ||
externals = this.externals, | ||
_additionalScripts = this.additionalScripts, | ||
additionalScripts = _additionalScripts === undefined ? [] : _additionalScripts; | ||
@@ -158,5 +160,5 @@ | ||
return '<script src="' + externals[key].client(debug) + '"></script>'; | ||
}).join('') + '\n <script src="dist/bundle' + (debug ? '.debug' : '') + '.js"></script>\n ' + (additionalScripts && additionalScripts.map(function (script) { | ||
}).join('') + '\n <script src="dist/bundle' + (debug ? '.debug' : '') + '.js"></script>\n ' + additionalScripts.map(function (script) { | ||
return script.contents ? '<script>' + script.contents + '</script>' : '<script src="' + script.url + '"></script>'; | ||
}).join('')) + '\n </body>\n </html>\n '; | ||
}).join('') + '\n </body>\n </html>\n '; | ||
} | ||
@@ -225,4 +227,4 @@ }, { | ||
fs.mkdirpSync('/dist'); | ||
fs.writeFileSync('/index.html', this.getTemplate(staticFiles.css, staticFiles.html, false, this.additionalScripts)); | ||
fs.writeFileSync('/index.debug.html', this.getTemplate(staticFilesDebug.css, staticFilesDebug.html, true, this.additionalScripts)); | ||
fs.writeFileSync('/index.html', this.getTemplate(staticFiles.css, staticFiles.html)); | ||
fs.writeFileSync('/index.debug.html', this.getTemplate(staticFilesDebug.css, staticFilesDebug.html, true)); | ||
fs.writeFileSync('/src/app.js', source); | ||
@@ -229,0 +231,0 @@ fs.writeFileSync('/src/main.js', this.getMain(staticFiles.cssIds)); |
{ | ||
"name": "@spin-io/sdk-app-compiler", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "SPIN app compiler", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -74,4 +74,4 @@ import webpack from 'webpack' | ||
getTemplate(css, html, debug, additionalScripts) { | ||
const { name, externals } = this | ||
getTemplate(css, html, debug) { | ||
const { name, externals, additionalScripts = [] } = this | ||
@@ -101,3 +101,3 @@ return ` | ||
<script src="dist/bundle${debug ? '.debug' : ''}.js"></script> | ||
${additionalScripts && additionalScripts.map(script => ( | ||
${additionalScripts.map(script => ( | ||
script.contents | ||
@@ -184,5 +184,5 @@ ? `<script>${script.contents}</script>` | ||
fs.writeFileSync('/index.html', | ||
this.getTemplate(staticFiles.css, staticFiles.html, false, this.additionalScripts)) | ||
this.getTemplate(staticFiles.css, staticFiles.html)) | ||
fs.writeFileSync('/index.debug.html', | ||
this.getTemplate(staticFilesDebug.css, staticFilesDebug.html, true, this.additionalScripts)) | ||
this.getTemplate(staticFilesDebug.css, staticFilesDebug.html, true)) | ||
fs.writeFileSync('/src/app.js', source) | ||
@@ -189,0 +189,0 @@ fs.writeFileSync('/src/main.js', this.getMain(staticFiles.cssIds)) |
382
0.53%128086
-0.02%