I am trying to load a script and I tried both ways <script src="~/Plugins/My.Plugin/Scripts/script.js" asp-location="Head"></script> and in the code NopHtml.AppendScriptParts(ResourceLocation.Head, "~/Plugins/My.Plugin/Scripts/script.js"); I also tried <script asp-exclude-from-bundle="true" src="~/Plugins/My.Plugin/Scripts/script.js" asp-location="Head"></script> And putting it in the footer does not work either
All ways I tried seems to be creating an error in the script
Uncaught SyntaxError: Unexpected token 'else' It seems the script gets changed
This script has the error at the bold else e=u.createBookmarks(),(r?f:i).moveChildren(r?i:f,!1),n.lastElement.mergeSiblings(),a(f,i,!r),u.selectBookmarks(e),n=!0)}else n=!1};else r=i,u=n.block,i=r.endPath().block,u&&i&&!u.equals(i)?(t.fire("saveSnapshot"),
This script does not have an error (loaded directly in a html page) f=h.createBookmarks();(c?e:d).moveChildren(c?d:e,!1);b.lastElement.mergeSiblings();g(e,d,!c);h.selectBookmarks(f);b=!0}}else b=!1}else c=d,h=b.block,d=c.endPath().block,h&&d&&!h.equals(d)?(a.fire("saveSnapshot"),
I dont know - it Is looks like it is inserting ;
Is there anyway to load a script without it being modified by the minification ?
Note: It is a commercial script - not something I am developing P.S> And I tried a different browsers
At some cases if there any unsupported css lines present at un-minified version of css after minification it gives error. please check whole css of un-minified version by opening at VS editor that any underline marked (warning or unsupported)) lined present or not.
Hi! Unfortunately, there isn't enough information to detect the source of this issue, but you can disable processing through the Tag Helper opt-out character ("!"). It can be either a bug in the bundling library or a syntax mistake in the script.
Ok I changed the address to load the file from CDN and it works I save the same file to the plugin directory and load it from there and it does not work Seems the minification / bundler or what ever is going on does not work with some files The code gets changed and it creates errors It would be good if there was a way to just load the .js file and not change it
I am back on this problem trying to work out why I can not load a script from a directory and why it seems to be getting corrupted by something ? See above
There is a script file loaded and when I Inspect it in the browser its not the same file and has been minimised and has errors ?
I dont know if nopCommerce is doing it or does the browser do it or something else ?
There shoud be a way to load a script file and not have it changed by something
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.