2

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?

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.