Reputation: 639
Is there a way to use bundling in a .NET Core Web Application without node.js (and gulp)?
Official Microsoft documentation goes the way with node/gulp: https://learn.microsoft.com/en-us/aspnet/core/client-side/bundling-and-minification?view=aspnetcore-3.1
Is there a better / lighter way?
Upvotes: 1
Views: 2127
Reputation: 257
Best practice for bundling and minifications suggested by official Microsoft is following.
https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
An open-source bundling and minification solution... https://github.com/ligershark/WebOptimizer
Upvotes: 1
Reputation: 3127
Install the Bundler & Minifier extension, you'll get a file named bundleconfig.json
, then configure it this way:
[
{
"outputFileName": "wwwroot/js/Production/script.min.js",
"inputFiles": [
"wwwroot/lib/somelibrary/lib.js"
],
"minify": {
"enabled": true,
"renameLocals": true
},
"sourceMap": false
},
{
"outputFileName": "wwwroot/css/Production/style.min.css",
"inputFiles": [
"wwwroot/lib/somelibrary/css/style.css",
],
"minify": { "enabled": true }
},
]
Your files will be bundled on save like in the config file.
Upvotes: 0