UNPKG

@financial-times/o-assets

Version:

_Deprecated._ `o-assets` does not support Origami components delivered via npm or version 2 of the Origami specification.

60 lines (47 loc) 1.15 kB
var globalPrefix = '/bower_components/'; var moduleVersions = {}; var modulePaths = {}; function trim(s) { return s.replace(/^\/+/, '').replace(/\/+$/, ''); } function setGlobalPathPrefix(newprefix) { if (typeof newprefix !== 'undefined') { globalPrefix = newprefix; } return this; } // left in for backwards compatibility but shouldn't be needed hereonin function setModuleVersions(map) { for (var i in map) { if (i) { moduleVersions[i] = trim(map[i]); } } return this; } function setModulePaths(map) { for (var i in map) { if (i) { modulePaths[i] = trim(map[i]); } } return this; } function resolve(path, modulename) { var fullpath = trim(path); if (typeof modulePaths[modulename] !== 'undefined') { fullpath = modulePaths[modulename] + '/' + fullpath; } else { fullpath = modulename + '/' + fullpath; if (globalPrefix) { fullpath = globalPrefix + fullpath; } } return fullpath; } export default { setGlobalPathPrefix, setModuleVersions, setModulePaths, resolve }; export { setGlobalPathPrefix, setModuleVersions, setModulePaths, resolve };