Commit d5770069 authored by Robert Knight's avatar Robert Knight

Make the asset root URL relative to the root of the package

When serving the package's contents via an npm CDN such as unpkg.com, it
will be more convenient if the asset root URL provided by the service
refers to the root of the package rather than the root of the `build/`
dir.
parent 8bbf9b99
...@@ -21,7 +21,7 @@ function injectScript(doc, src) { ...@@ -21,7 +21,7 @@ function injectScript(doc, src) {
function injectAssets(doc, config, assets) { function injectAssets(doc, config, assets) {
assets.forEach(function (path) { assets.forEach(function (path) {
var url = config.assetRoot + config.manifest[path]; var url = config.assetRoot + 'build/' + config.manifest[path];
if (url.match(/\.css/)) { if (url.match(/\.css/)) {
injectStylesheet(doc, url); injectStylesheet(doc, url);
} else { } else {
......
...@@ -77,7 +77,7 @@ describe('bootstrap', function () { ...@@ -77,7 +77,7 @@ describe('bootstrap', function () {
'styles/inject.1234.css', 'styles/inject.1234.css',
'styles/pdfjs-overrides.1234.css', 'styles/pdfjs-overrides.1234.css',
].map(function (url) { ].map(function (url) {
return 'https://marginal.ly/client/' + url; return 'https://marginal.ly/client/build/' + url;
}); });
assert.deepEqual(findAssets(iframe.contentDocument), expectedAssets); assert.deepEqual(findAssets(iframe.contentDocument), expectedAssets);
...@@ -131,7 +131,7 @@ describe('bootstrap', function () { ...@@ -131,7 +131,7 @@ describe('bootstrap', function () {
'styles/icomoon.1234.css', 'styles/icomoon.1234.css',
'styles/katex.min.1234.css', 'styles/katex.min.1234.css',
].map(function (url) { ].map(function (url) {
return 'https://marginal.ly/client/' + url; return 'https://marginal.ly/client/build/' + url;
}); });
assert.deepEqual(findAssets(iframe.contentDocument), expectedAssets); assert.deepEqual(findAssets(iframe.contentDocument), expectedAssets);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment