Skip to content

Instantly share code, notes, and snippets.

@arutnik
Created November 5, 2017 20:10
Show Gist options
  • Select an option

  • Save arutnik/ad61e6a428b76bfa8493deb982e9818e to your computer and use it in GitHub Desktop.

Select an option

Save arutnik/ad61e6a428b76bfa8493deb982e9818e to your computer and use it in GitHub Desktop.
SFA Part 4: Static asset pipe
declare var getSfStaticResourceRoot : () => string;
export function getStaticPathForResource(resourcePath : string) {
return getSfStaticResourceRoot() + resourcePath;
}
/*
* Ensures a static asset path gets the right prefix
*/
@Pipe({name: 'staticpath'})
export class StaticPathPipe implements PipeTransform {
transform(value: string): string {
return getStaticPathForResource(value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment