@ubox-tools/deploy-xperience 1.1.8 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deploy.js +10 -0
- package/package.json +1 -1
package/deploy.js
CHANGED
|
@@ -256,6 +256,16 @@ function generateProxy(appName) {
|
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
if (isHTML) {
|
|
259
|
+
// Asset path substitution for HTML src/href attributes
|
|
260
|
+
const assetInStringRe = /(['"])(?:\.\.\/)*assets\/([^'"]+)\1/g;
|
|
261
|
+
content = content.replace(assetInStringRe, (match, quote, assetFile) => {
|
|
262
|
+
const assetExt = path.extname(assetFile).slice(1).toLowerCase();
|
|
263
|
+
const type = assetResourceType(assetExt);
|
|
264
|
+
const absPath = path.join(ASSETS_DIR, assetFile);
|
|
265
|
+
if (fs.existsSync(absPath)) assets[assetFile] = { type, absPath };
|
|
266
|
+
return `"{resources:${type}/${assetFile}}"`;
|
|
267
|
+
});
|
|
268
|
+
|
|
259
269
|
// Strip local <link> tags (keep CDN ones with https://)
|
|
260
270
|
content = content.replace(/<link\b[^>]*\bhref=["'](?!https?:\/\/)[^"']*["'][^>]*\/?>/gi, '');
|
|
261
271
|
// Strip local <script src> tags (keep CDN ones)
|
package/package.json
CHANGED