UNPKG

@tdb/web

Version:

Common condiguration for serving a web-site and testing web-based UI components.

22 lines (18 loc) 478 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = asset; exports.setAssetPrefix = setAssetPrefix; var assetPrefix; function asset(path) { // If the URL starts with http, we assume it's an if (/^https?:\/\//.test(path)) { return path; } var pathWithoutSlash = path.replace(/^\//, ''); return "".concat(assetPrefix || '', "/static/").concat(pathWithoutSlash); } function setAssetPrefix(url) { assetPrefix = url; }