Add a 3rd resource type or a 2nd place to inject resources #776
Unanswered
markdav-is
asked this question in
Ideas
Replies: 2 comments 4 replies
-
Example #16 might be used to help implement path B. |
Beta Was this translation helpful? Give feedback.
3 replies
-
Are you saying that Blazorise does not work when it is registered in the head? @markdav-is Please see #764 as there is related conversation there. In regards to the options laid out above my preference would be option B of the items you outlined ( extend Oqtane.Models.Resource class with another property ) - however I think some higher level decisions need to be made before this is introduced. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We currently have two resources types: Stylesheet & Script. When listing resource using IHostResources or ModuleBase Resources property, those resources are injected into the head tag of the main layout in _host.cshtml using @Html.Raw(@Model.Resources). This works great for css and js references, but some js components also need to some code to run in the body of the page to initialize. In those cases, it would be nice to inject those resources scripts into the body.
I see two paths that can start a conversation:
A) Add a third resource type to enum ResourceType called BodyScript. Any resource added as a BodyScript would get injected into the body in the _host.cshtml using @Html.Raw(@Model.BodyScripts). That is a new property that builds <script> tags for each.
B) Add a ResourceLocation enum with Head and Body members. Then overload the Resource class to have a ResourceLocation that defaults to Head. injected resources into the head or body in the _host.cshtml using @Html.Raw(@Model.HeadResources) or into the body using @Html.Raw(@Model.BodyResources) That is a new property that builds <script> tags for each.
I need this feature for the work I'm doing the IHostResouces and Blazorise. So I'll likely make a PR for the A case to check out soon.
Beta Was this translation helpful? Give feedback.
All reactions