-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bundle files without minifying them #71
Comments
Instead of using AddJavaScriptBundle(...) use a custom pipeline: pipeline.AddBundle("/js/bundle.js", "text/javascript; charset=UTF-8", "/js/a.js", "/js/b.js")
.Concatenate(); // This is what makes the bundle |
I would say that passing a "CodeSettings" instance to the AddJavaScript bundle like pipeline.AddJavaScriptBundle("/bundle-frontend.js",
new CodeSettings()
{
MinifyCode = false
},
"/js/helper.analytics.js",
"/js/view.frontend.site.js",
); Should be respected, right now it's not I just made a copy of it to solve this temporary: public static IAsset AddJsBundle(
this IAssetPipeline pipeline,
string route,
CodeSettings settings,
params string[] sourceFiles)
{
if(settings.MinifyCode)
return pipeline.AddBundle(route, "text/javascript; charset=UTF-8", sourceFiles)
.EnforceFileExtensions(".js", ".jsx", ".es5", ".es6")
.Concatenate()
.AddResponseHeader("X-Content-Type-Options", "nosniff")
.MinifyJavaScript(settings);
return pipeline.AddBundle(route, "text/javascript; charset=UTF-8", sourceFiles)
.EnforceFileExtensions(".js", ".jsx", ".es5", ".es6")
.Concatenate()
.AddResponseHeader("X-Content-Type-Options", "nosniff");
} |
Any chance this will be implemented/fixed? The AddJavaScriptBundle does not allow to prevent the file from being minified even if you pass the settings. |
Submitted #245 to try and address this |
Can't wait to get this fix in the next nuget. |
The fix I did has now been released which I thought I'd put here as I checked on it today |
Hi,
from your main site:
"Bundling is the process of taking multiple source files and combining them into a single output file. All CSS and JavaScript bundles are also being automatically minified."
I want to debug my code during development thus I do not want minified code, but I want it bundled as my index.cshtml file always references a single all.js file.
How can I disable the minification of a bundle?
The text was updated successfully, but these errors were encountered: