How to use the aurelia-path.relativeToFile function in aurelia-path

To help you get started, we’ve selected a few aurelia-path examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aurelia / templating-router / dist / native-modules / route-loader.js View on Github external
TemplatingRouteLoader.prototype.loadRoute = function loadRoute(router, config) {
    var childContainer = router.container.createChild();

    var viewModel = void 0;
    if (config.moduleId === null) {
      viewModel = EmptyClass;
    } else if (/\.html/i.test(config.moduleId)) {
      viewModel = createDynamicClass(config.moduleId);
    } else {
      viewModel = relativeToFile(config.moduleId, Origin.get(router.container.viewModel.constructor).moduleId);
    }

    var instruction = {
      viewModel: viewModel,
      childContainer: childContainer,
      view: config.view || config.viewStrategy,
      router: router
    };

    childContainer.registerSingleton(RouterViewLocator);

    childContainer.getChildRouter = function () {
      var childRouter = void 0;

      childContainer.registerHandler(Router, function (c) {
        return childRouter || (childRouter = router.createChild(childContainer));
github aurelia / ux / dist / es2015 / styles / style-strategy.js View on Github external
makeRelativeTo(file) {
        if (this.absolutePath === null) {
            this.absolutePath = relativeToFile(this.path, file);
        }
    }
};
github aurelia / templating-resources / dist / native-modules / css-resource.js View on Github external
return css.replace(cssUrlMatcher, function (match, p1) {
    var quote = p1.charAt(0);
    if (quote === '\'' || quote === '"') {
      p1 = p1.substr(1, p1.length - 2);
    }
    return 'url(\'' + relativeToFile(p1, address) + '\')';
  });
}
github cmichaelgraham / aurelia-ts-port / dist / commonjs / framework / aurelia.js View on Github external
Aurelia.prototype.globalizeResources = function (resources) {
        var toAdd = Array.isArray(resources) ? resources : arguments, i, ii, resource, pluginPath = this.currentPluginId || '', path, internalPlugin = pluginPath.startsWith('./');
        for (i = 0, ii = toAdd.length; i < ii; ++i) {
            resource = toAdd[i];
            if (typeof resource != 'string') {
                throw new Error("Invalid resource path [" + resource + "]. Resources must be specified as relative module IDs.");
            }
            path = internalPlugin
                ? aurelia_path_1.relativeToFile(resource, pluginPath)
                : aurelia_path_1.join(pluginPath, resource);
            this.resourcesToLoad[path] = this.resourcesToLoad[path];
        }
        return this;
    };
    /**
github aurelia / ux / src / styles / style-strategy.ts View on Github external
return css.replace(cssUrlMatcher, (_, p1) => {
    const quote = p1.charAt(0);

    if (quote === '\'' || quote === '"') {
      p1 = p1.substr(1, p1.length - 2);
    }

    return 'url(\'' + relativeToFile(p1, address) + '\')';
  });
}
github aurelia / templating / src / view-engine.js View on Github external
if (dependencies.length === 0 && !compileInstruction.associatedModuleId) {
      return Promise.resolve(resources);
    }

    importIds = dependencies.map(x => x.src);
    names = dependencies.map(x => x.name);
    logger.debug(`importing resources for ${registryEntry.address}`, importIds);

    if (target) {
      let viewModelRequires = metadata.get(ViewEngine.viewModelRequireMetadataKey, target);
      if (viewModelRequires) {
        let templateImportCount = importIds.length;
        for (let i = 0, ii = viewModelRequires.length; i < ii; ++i) {
          let req = viewModelRequires[i];
          let importId = typeof req === 'function' ? Origin.get(req).moduleId : relativeToFile(req.src || req, registryEntry.address);

          if (importIds.indexOf(importId) === -1) {
            importIds.push(importId);
            names.push(req.as);
          }
        }
        logger.debug(`importing ViewModel resources for ${compileInstruction.associatedModuleId}`, importIds.slice(templateImportCount));
      }
    }

    return this.importViewResources(importIds, names, resources, compileInstruction, loadContext);
  }
github cmichaelgraham / aurelia-ts-port / aurelia-ts / templating / view-strategy.ts View on Github external
loadViewFactory(viewEngine, options){
    if(!this.absolutePath && this.moduleId){
      this.absolutePath = relativeToFile(this.path, this.moduleId);
    }

    return viewEngine.loadViewFactory(this.absolutePath || this.path, options, this.moduleId);
  }
github aurelia / ux / dist / native-modules / styles / style-strategy.js View on Github external
return css.replace(cssUrlMatcher, function (_, p1) {
        var quote = p1.charAt(0);
        if (quote === '\'' || quote === '"') {
            p1 = p1.substr(1, p1.length - 2);
        }
        return 'url(\'' + relativeToFile(p1, address) + '\')';
    });
}
github aurelia / templating-resources / dist / es2015 / css-resource.js View on Github external
return css.replace(cssUrlMatcher, (match, p1) => {
    let quote = p1.charAt(0);
    if (quote === '\'' || quote === '"') {
      p1 = p1.substr(1, p1.length - 2);
    }
    return 'url(\'' + relativeToFile(p1, address) + '\')';
  });
}
github aurelia / ux / dist / commonjs / styles / style-strategy.js View on Github external
return css.replace(cssUrlMatcher, function (_, p1) {
        var quote = p1.charAt(0);
        if (quote === '\'' || quote === '"') {
            p1 = p1.substr(1, p1.length - 2);
        }
        return 'url(\'' + aurelia_path_1.relativeToFile(p1, address) + '\')';
    });
}

aurelia-path

Utilities for path manipulation.

MIT
Latest version published 4 months ago

Package Health Score

67 / 100
Full package analysis