Open DemeSzabolcs opened 2 years ago
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 https://github.com/OrchardCMS/OrchardCore/pull/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
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.