Loading scripts in v4.5 creates an error

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
1 year ago
hkbits wrote:
Works fine here on localhost.

I disabled disk cache in appsettings and i dont use iis of course


Suddenly it's work

<!script src="/Plugins/Payments.pluginPayment/Scripts/folder/file.js" type="text/javascript"></!script>
But what about CSS file still didn't load
1 year ago
You can also try <!link just like <!script

If you press F12 in visual studio on <script> you see that nop has make a class which is run when using <script> and <link>.

Its in Nop.Web.Framework.TagHelpers.Shared

In order to bypass(not use) the built in loader for script and link you can use ! in front.

And remember to mark the file as Content on Build action.
1 year ago
hkbits wrote:
You can also try <!link just like <!script

If you press F12 in visual studio on <script> you see that nop has make a class which is run when using <script> and <link>.

Its in Nop.Web.Framework.TagHelpers.Shared

In order to bypass(not use) the built in loader for script and link you can use ! in front.

And remember to mark the file as Content on Build action.


Great ! That's work with me
But why use this way!
I was check the plugin for nopcommerce and source code didn't use this way. And what means when use this <! for link and script?
1 year ago
I had a problem with this problem while developing the plugin.
This is how I found the solution.
version 5.40.3
step 1 : Configuration -> Settings -> App Settings -> minifyI have closed.
step2 : If you configure your cproj file correctly, there is no problem in the debug process.
plugin.cproj
 
<ItemGroup>
    <None Remove="logo.png" />
    <None Remove="Content\css\style.css" />
    <None Remove="Content\lib\swipper\swiper-bundle.css" />
    <None Remove="Content\lib\swipper\swiper-bundle.js" />
    <None Remove="Content\lib\swipper\swiper-bundle.js.map" />
    <None Remove="Views\PublicInfo.cshtml" />  
    <None Remove="Views\_ViewImports.cshtml" />
  </ItemGroup>


plugin.cproj

  <ItemGroup>
   <Content Include="logo.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="Content\css\style.css">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="Content\lib\swipper\swiper-bundle.css">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="Content\lib\swipper\swiper-bundle.js">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>    
    <Content Include="Content\lib\swipper\swiper-bundle.js.map">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="Views\PublicInfo.cshtml">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="Views\_ViewImports.cshtml">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>


Views\PublicInfo.cshtml

<link rel="stylesheet" href="~/Plugins/Widgets.Sample/Content/lib/swipper/swiper-bundle.css" />
<link rel="stylesheet" href="~/Plugins/Widgets.Sample/Content/css/style.css" />
<script src="~/Plugins/Widgets.Sample/lib/swipper/swiper-bundle.js" type="text/javascript"></script>
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.