Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative path to assets #71

Open
shawnthompson opened this issue Jan 20, 2020 · 0 comments
Open

Relative path to assets #71

shawnthompson opened this issue Jan 20, 2020 · 0 comments

Comments

@shawnthompson
Copy link

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...)

<link rel="stylesheet" href='{call .environment data="all" /}css/theme.css'>

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?

Link to project: https://github.com/wet-boew/cdts-sgdc

Link to open issue: google/closure-templates#200

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant