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 paths #200

Open
shawnthompson opened this issue Jan 15, 2020 · 1 comment
Open

relative paths #200

shawnthompson opened this issue Jan 15, 2020 · 1 comment

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?

Thank you for your time,
Shawn

@shawnthompson
Copy link
Author

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

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