JS file in ASP Net Core

Asked

Viewed 73 times

0

I created an ASP Net Core project following the MVC standard, in the project there is the folder wwwroot that contains the images, css and javascript same. In the javascript folder has two files, one above with the name of "site js." and another under the name of "site.minjs.", made a Mask and put in the second file (site.min.js) but when trying to bring it to view using the following code I was not successful:

<script type="text/javascript" src="~/js/site.min.js"></script>

I wonder if the files have hierarchy because one is inside the other and so does not work.

inserir a descrição da imagem aqui

  • The files are not "inside each other". Visual studio presents this way to indicate that .min.js is related ok to js from above. This behavior can be disabled.

  • About this feature: https://docs.microsoft.com/en-us/visualstudio/ide/file-nesting-solution-explorer?view=vs-2019

1 answer

-2

This "min" is minifier file, it is configurable by bundleconfig.json. Within this setting you inform which or which files you want to "minify" (reduce the size) and which name the minified will have. So you need to change only the "site.js" and when compiling it is packaged and transformed into the "site.min.js".

More details here: Package and reduce static assets in ASP.NET Core

Browser other questions tagged

You are not signed in. Login or sign up in order to post.