Gathering detailed insights and metrics for ember-cli-resolve-asset
Gathering detailed insights and metrics for ember-cli-resolve-asset
Gathering detailed insights and metrics for ember-cli-resolve-asset
Gathering detailed insights and metrics for ember-cli-resolve-asset
Resolves asset paths to their fingerprinted counterpart. Useful for interpolated paths.
npm install ember-cli-resolve-asset
Typescript
Module System
Min. Node Version
JavaScript (92.98%)
HTML (7.02%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
10 Stars
241 Commits
1 Forks
2 Watchers
23 Branches
2 Contributors
Updated on Nov 15, 2020
Latest Version
0.3.0
Package Id
ember-cli-resolve-asset@0.3.0
Unpacked Size
17.98 kB
Size
6.63 kB
File Count
27
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
26
Imperatively resolves assets fingerprinted by
broccoli-asset-rev
, which allows you to even resolve
interpolated paths.
ember install ember-cli-resolve-asset
If you want to use this in one of your addons, the consuming host application
will also need to install ember-cli-resolve-asset
. If this not a case, a
helpful build error will be shown.
The following configuration in your ember-cli-build.js
is required for this
addon to work correctly.
1const app = new EmberAddon(defaults, {
2 fingerprint: {
3 enabled: true, // If false, this addon is disabled also.
4 generateAssetMap: true, // Required.
5 fingerprintAssetMap: true // Recommended to prevent caching issues.
6 },
7
8 'ember-fetch': {
9 preferNative: true // Recommended to enable faster preloading for browsers that support it.
10 }
11});
resolveAsset
async resolveAsset(path: string, withoutPrepend = false): Promise<string>
Asynchronously resolves the given path
from the asset map.
If the asset map is not loaded yet, this function will wait for it.
If loading the asset map fails, the returned Promise
will reject.
If the path is not listed in the asset map, the returned Promise
will reject.
1import Route from '@ember/routing/route'; 2import { inject as service } from '@ember/service'; 3import fetch from 'fetch'; 4import resolveAsset from 'ember-cli-resolve-asset'; 5 6export default class ApplicationRoute extends Route { 7 @service intl; 8 @service language; 9 10 async beforeModel() { 11 const preferredLanguage = this.language.getPreferredLanguage(); 12 const translationsPath = await resolveAsset( 13 `translations/${preferredLanguage}.json` 14 ); 15 const translations = await fetch(translationsPath); 16 17 this.intl.addTranslations(preferredLanguage, await translations.json()); 18 this.intl.setLocale(preferredLanguage); 19 } 20}
resolveAssetSync
resolveAssetSync(path: string, withoutPrepend = false): string
Synchronous version of resolveAsset
.
Synchronously resolves the given path
from the asset map.
If the asset map is not loaded yet, this function will throw. If the path is not listed in the asset map, this function will throw.
Usage of this function is discouraged in favor of resolveAsset
. Only use this
function, if using the async version is not feasible and if you can guarantee,
that load
ran to completion beforehand.
1import Route from '@ember/routing/route'; 2import { inject as service } from '@ember/service'; 3import fetch from 'fetch'; 4import { 5 resolveAssetSync, 6 load as loadAssetMap 7} from 'ember-cli-resolve-asset'; 8 9export default class ApplicationRoute extends Route { 10 @service intl; 11 @service language; 12 13 async beforeModel() { 14 await loadAssetMap(); 15 16 const preferredLanguage = this.language.getPreferredLanguage(); 17 const translationsPath = resolveAssetSync( 18 `translations/${preferredLanguage}.json` 19 ); 20 const translations = await fetch(translationsPath); 21 22 this.intl.addTranslations(preferredLanguage, await translations.json()); 23 this.intl.setLocale(preferredLanguage); 24 } 25}
load
async load(): Promise<void>
This function returns a Promise
that resolves once the asset map was loaded
successfully. Repeatedly calling this function returns the same Promise
. After
this Promise
has resolved, you can use
resolveAssetSync
.
This function is called automatically by an initializer, to start the loading of the asset map as soon as possible. This means there is no direct need for you to call this function yourself, unless you want to await the asset map explicitly.
broccoli-asset-rev
: The ember-cli addon that
performs the fingerprinting and generates the asset map.ember-fetch
: Used by this addon to asynchronously load
the asset map.ember-cli-ifa
: The original inspiration for this addon.
I was dissatisfied with the technical implementation, the bugs it caused and
current state of maintenance, which is why I created this addon instead.No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/23 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
79 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More