Update URLs to "external" so developer can share with multiple devices.
This commit is contained in:
+2
-2
@@ -13,10 +13,10 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
window.devTool = {
|
window.devTool = {
|
||||||
previewFrameUrl: 'http://localhost:{{ port }}/view/{{ baseView }}',
|
previewFrameUrl: '{{ previewFrameUrl }}',
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<iframe id="preview_frame" src="http://localhost:{{ port }}/view/{{ baseView }}" class="breakpoint"></iframe>
|
<iframe id="preview_frame" src="{{ previewFrameUrl }}" class="breakpoint"></iframe>
|
||||||
|
|
||||||
<script src="/scripts/dist/index.min.js"></script>
|
<script src="/scripts/dist/index.min.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ buildScriptFiles()
|
|||||||
|
|
||||||
let port = 3000;
|
let port = 3000;
|
||||||
let externalUrl = '';
|
let externalUrl = '';
|
||||||
|
let previewFrameUrl = `http://localhost:${port}`;
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
const hbs = create({
|
const hbs = create({
|
||||||
@@ -71,13 +72,14 @@ app.get('/', async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const baseView = config.has('baseView') ? config.get('baseView') : 'container';
|
const baseView = config.has('baseView') ? config.get('baseView') : 'container';
|
||||||
|
const baseViewUrl = `view/${baseView}`;
|
||||||
|
|
||||||
data.helpers = {
|
data.helpers = {
|
||||||
port,
|
port,
|
||||||
include_partial: (path) => projectDir + path,
|
include_partial: (path) => projectDir + path,
|
||||||
baseView: baseView,
|
baseView,
|
||||||
externalUrl: `${externalUrl}/view/${baseView}`,
|
externalUrl: `${externalUrl}/${baseViewUrl}`,
|
||||||
previewFrameUrl: `http://localhost:${port}/view/${baseView}`,
|
previewFrameUrl: `${previewFrameUrl}/${baseViewUrl}`,
|
||||||
}
|
}
|
||||||
|
|
||||||
res.render('index', data);
|
res.render('index', data);
|
||||||
@@ -210,8 +212,10 @@ const listener = app.listen(0, async () => {
|
|||||||
proxy: `http://localhost:${PORT}`,
|
proxy: `http://localhost:${PORT}`,
|
||||||
open: false
|
open: false
|
||||||
}, (err, bs) => {
|
}, (err, bs) => {
|
||||||
externalUrl = bs.getOptionIn(["urls"]).get('external');
|
const options = bs.getOptions().toJS();
|
||||||
port = bs.server._connectionKey.split(':').pop();
|
previewFrameUrl = options.urls.external;
|
||||||
|
externalUrl = previewFrameUrl.replace(options.port, options.proxy.url.port);
|
||||||
|
port = options.port;
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user