google / google/closure-templates
relative paths
- Dominant language
- Java
- Stars
- 700
- Forks
- 199
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 26
Description
At work I inherited a JavaScript templating project which is built using Google Closure Templates and I am trying to convert it into a CI/CD project, make it open and let others use it and contribute to it.
## Background ##
The project was created so that web applications and sites that use our template just have to point to a server setup as a CDN that hosted our files.
## Issue ##
All our paths were set with an .environment template with if conditions for different servers our files reside on.
```
/**
* @param cdnEnv Used to switch between qat, dev, and prod implementations.
*/
{template .environment}
/**{@param cdnEnv}*/
{if $cdnEnv=='qat'}
https://qat.domain.com
{elseif $cdnEnv=='dev'}
https://dev.domain.com
{else}
https://domain.com{/if}/ourfiles/
{/if}
{/template}
```
Then we call it in the different templates to access our resource files (css, js, images, etc...)
```
```
I want our templates to work no matter where we host the files, but if I change the paths to relative to the JS, once it gets injected in the page, it becomes relative to the page itself and breaks.
Is there a way to achieve this?
Thank you for your time,
Shawn
Contributor guide
Assessment
This issue has not been assessed yet.