![]() With this in place, you can replace all of the elements from the previous example with this: To use the tag helpers in cshtml files, insert the following code in the _ViewImports.cshtml file: *, BundlerMinifier.TagHelpers To combine these into one, there's a nice little NuGet package named BundlerMinifier.TagHelpers that we can install: dotnet add package BundlerMinifier.TagHelpersĪs the name suggests, this package comes with a range of ASP.NET Core tag helpers to help with bundling and minification. gitignore: # Don't include bundled files in gitĪs we already saw in the example code, we have a reference to both bootstrap.css and site.css in both the bundleconfig.json file and in the HTML file needing this (typically the _Layout.cshtml file). This way you can simply ignore this path in. The only change is the path in the outputFileName value which now avoids generating the bundled files inside the css and js folders. You can either create a set of wildcard URLs to exclude or you can move the generated bundles entirely like this: [ gitignore, since someone will end up generating these files locally either by mistake or to test out a problem only existing on the bundled files. You probably still want to exclude these files through. min files will not even exist in your local checkout. The solution suggested in this post is based on not building the minified bundles locally. ![]() If you have the BuildBundlerMinifier package installed, go ahead and uninstall it. The first part doesn't require more explanation. In the following sections, I have a solution for each bullet.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |