-
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
liquid script tag does not render custom attributes #16348
Comments
@bashuss I can't reproduce this issue with the latest code from main, I think everything is rendered as expected, as you can see in this image: |
@mdameer What was the exact liquid code you used? Maybe I have a typo... |
Same here; maybe we fixed it in the two weeks since that preview version. I get this: <script src="/blog2/OrchardCore.Resources/Scripts/jquery.min.js"></script>
<script defer="defer" src="/Vendor/pdfjs/build/pdf.js" type="module"></script> With:
I used the Blog recipe, and put this into a template named |
Thanks for testing! I'll wait a while and try again. |
As it is ok for you, I'll reopen, if I cannot make it work within the next month. Not in a hurry here... |
Why this should be open if the issue not exist? |
Yeah, please just confirm, I wouldn't like to keep a dangling issue open. |
Is there a quick way to switch between full git checkout and nuget packages? I would like a quick way to see, if the nuget to checkout makes the difference, or if I have to search for something specific in my project. |
Is there a quick way to switch between full git checkout and nuget packages? I would like a quick way to see, if the nuget to checkout makes the difference, or if I have to search for something specific in my project. |
It's not quick, but you can configure a local NuGet folder and |
Not sure if you meant that: I copied the OrchardCore.Cms.Web.csproj file and renamed it to OrchardCore.Cms.Web.Nuget.csproj, replaced the cms.Targets project reference by the preview nuget package a')nd configured a different build path ('/bin-nuget'). The other difference I see between my project and the fresh checkout is, that the required
As there is also the difference between minified and non minified version, I thought, that the reason could be a difference between release and debug build. Trying to test this, I stumbled over this: #16358 Can you point me to the code that renders the script tag? I'd like to check, if there are any configurations, which may cause the difference between my project and the clean checkout. |
My only guess is that your theme has no reference to either You can start from here: https://github.com/OrchardCMS/OrchardCore/blob/main/src/OrchardCore/OrchardCore.ResourceManagement/TagHelpers/ScriptTagHelper.cs |
I thought, that it might be my theme, so I switched to different front end themes - no success within my project. |
My theme had used So it is a tenant specific setting or feature, that creates the problem. |
From this I can't help, sorry. |
Found the problem: works fine, as long as no script depends on it.
the extra attributes are not rendered anymore. This also is the only thing that makes sense with the existing code - without have found the exact location of the problem yet. |
I don't think that code block makes sense, since you can't include an external script and add inline code at the same time. We could throw an exception in this case. |
I don't understand your reasoning. You include one library script like pdf.js and then have a dependent custom script that works with it. This should be rather standard. Sure, I could write the code of the custom script in a .js file and host it with my app, but with the ability to create templates on the frontend, you may like to do something like this. Also adding an inline script within a template allows the script to have code variations depending on the Model of the shape and the custom settings. In my case this provides an easy way to handle the |
There's a missing clause in the ScriptTag.cs in the case when |
Describe the bug
liquid template line
{% script name:"pdf.js", src:"/Vendor/pdfjs/build/pdf.js", type:"module", defer:"defer", at:"head", depends_on:"jQuery" %}
renderes in
<head>
as:, so
defer
andtype
attributes are missing.When you look at the code of https://github.com/OrchardCMS/OrchardCore/blob/main/src/OrchardCore.Modules/OrchardCore.Resources/Liquid/ScriptTag.cs
it collects the custom attributes. Somewhere on the way to HTML, they get lost.
Orchard Core version
2.0.0-preview-18232
To Reproduce
Steps to reproduce the behavior:
{% script name:"somelocalscript", src:"/somelocalscript.js", type:"module", defer:"defer", at:"head", depends_on:"jQuery" %}
Edit: Not enough to reproduce: Please check this comment:
#16348 (comment)
Expected behavior
The text was updated successfully, but these errors were encountered: