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
Support CSS URLs when using root_path #8128
base: master
Are you sure you want to change the base?
Support CSS URLs when using root_path #8128
Conversation
- Support CSS urls when using `ckan.root_path` and/or a reverse proxy.
- Added change log file.
- Moved new css variables into its own style tage and block. - Conditioned the `url_for_static` on the `ckan.root_path` config.
- Added new css variables to sass scripts. - Made template condition better.
- Use `body` to override `:root` css variables.
@smotornyuk you mentioned that the |
https://webassets.readthedocs.io/en/latest/builtin_filters.html#cssrewrite Not sure where in the ckan code to put something like this? |
It's already been added to main/main-rtl assets Ideally, it must rewrite URLs automatically when the asset is assembled. I wonder if it rewrites the URL but does it in a wrong way, or is not applied at all. I'm sure this filter worked before for some files(and that's why it's added everywhere). If possible, it's better to debug the problem with the filter and fix it, or register a custom filter that does something similar appropriately. @JVickery-TBS, your fix is good for this particular case, but we need something that will work for every extension that relies on relative paths. I'd say that auto-fixing with cssrewrite looks tidier, so let's try debugging it and finding the problem. |
@smotornyuk from my understanding of reading https://webassets.readthedocs.io/en/latest/builtin_filters.html#cssrewrite, it rewrites based on the location of the output path. But if using CKAN's The filter works fine as far as I can tell. Is it just that I have not set up |
fix(css): uris with root_path;
ckan.root_path
.Proposed fixes:
The main css files use
url
values with relative paths, which results in them 404ing if someone has set up CKAN using ackan.root_path
.I have added CSS variables in a
root
css element in thebase.html
template so we can call theurl_for_static
helper. And used the variables throughout the stylesheets.Features:
Please [X] all the boxes above that apply