-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Style not using cdn_src even if CDN is enabled #11153
Comments
If you look at this line and analyze the code of that class.
You will see that it should work if you provide a "name" to your style resource. {% style name:"example", src:"~/example/css/example.css",
cdn_src:"https://example.com/css/example.css" %} Question is, should we make it work also without a "name" attribute. Maybe it is by design. Take a look and let us know. |
Hmm, I think when the name is missing, we could generate one based on one of the URLs. Or if it's required, then throw an exception. For now, I'll add an emphasis for it being required under #11154. |
I believe the razor tag helper handles this case. But if not then it's probably on purpose and we shouldn't change it. |
It's called an "inline" script/style definition (in case it's mentioned in the code). |
The 'name' triggers the behavior, otherwise it's just a <style> tag without custom logic from our side. |
The only logic required is to use either an src, debug_src, cdn_src, cdn_debug_src attribute on the tag based on the CDN settings applied on the tenant. |
Describe the bug
I wanted to use a local source and a CDN source for a
CSS
in aLayout.liquid
file. See:I turned on CDN inside Configuration -> Settings -> General -> Resources, but it still used the local source (
~/example/css/example.css
). I also tried enabling and disabling Resource Debug Mode under Configuration -> Settings -> General -> Resources, and enabling and disabling Cache Mode under Configuration -> Settings -> General -> Cache and it didn't work. I set theuse_cdn
attribute totrue
inside thestyle
but, it didn't work either.style
is always using the resource insrc
instead of the resource incdn_src
even when CDN is enabled.To Reproduce
Steps to reproduce the behavior:
style
to a.liquid
file, e.gLayout.liquid
.src
attribute to the style that's value points to a localCSS
file.cdn_src
attribute to the style that's value points to an externalCSS
file..liquid
file with thestyle
, and see that the page is using the local resource.Expected behavior
When CDN is enabled,
style
should use the resource given in thecdn_src
attribute instead of the resource given in thesrc
attribute.The text was updated successfully, but these errors were encountered: