-
Notifications
You must be signed in to change notification settings - Fork 49
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
url_for() equivalent to dynamically pick static files paths #194
Comments
I'm sorry, I don't think I understand your problem still. What would your code look like if this feature was implemented? Is this a jinja2 problem, or a staticjinja problem? Maybe if you link to a repo with the actual code and walk through what is annoying that would help. I'm tempted to say this isn't in the scope of staticjinja, and if you need this feature you should just write a script yourself that uses jinja. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This can be a little confusing to understand, so I will give you a case:
I have the following directory structure:
--static/
---styles/
----style_base.css
----style_module.css
----style_template.css
---styles_engine.css
--base.html
--index.html
--about/
---about-me.html
For context, the "styles_engine.css" file has some {% include "style_*.css" %} tags there to import all the other CSS files.
The use for the url_for() would be great for the "base.html" file, where it is imported to all other HTML templates. In practice, manually importing the "styles_engine.css" file works on the index.html if I do the raw path method, but it breaks on a subdirectory in the case of "about/about-me.html". url_for() would fix the paths dynamically.
Another example of this, is if I use any image or font inside the CSS file, it would break depending on the directory position of the template.
Does anyone have any idea of any alternatives to the url_for()? Currently my turn around is to do semthing like this:
In this case "internalDirectory" is set manually inside the template.
The text was updated successfully, but these errors were encountered: