madskristensen / bundlerminifier Goto Github PK
View Code? Open in Web Editor NEWVisual Studio extension
License: Other
Visual Studio extension
License: Other
Sample:
bundleconfig.json file:
[{
"outputFileName": "ScriptsV2/test/ab.bundle.js",
"inputFiles": [
"ScriptsV2/test/b.js",
"ScriptsV2/test/a.js"
],
"minify": {
"enabled": true
},
"includeInProject": true,
"sourceMaps": false
},
{
"outputFileName": "ScriptsV2/test/abc.bundle.js",
"inputFiles": [
"ScriptsV2/test/ab.bundle.js",
"ScriptsV2/test/c.js"
],
"minify": {
"enabled": true
},
"includeInProject": true,
"sourceMaps": false
}]
files:
a.js
b.js
c.js
bundles:
ab.bundle.js -> add files a.js + b.js
abc.bundle.js -> add files ab.bundle.js + c.js
situation:
when updating file "a.js" the bundle "abc.bundle.js" don't update on save of file "a.js" and even on build, just update with Shift+Alt+I :(
any help ?
tks
This is to make sure the JSON editor squiggles on file references that doesn't exist.
Unit tests are missing for:
Version: 1.1.57
Generated min.js files for both bundles and minified js files with sourcemap have an extra line below the //# sourceMappingURL=somefile.min.js.map. This seem to break source map loading in current version of Chrome (44.0).
Just installed Windows 10 + Visual Studio 2015 Community version.
I installed the extension.
Not seeing the menu on JS files.
Please HELP
Regards
I think that need a user interface for configuring of minification options like as in the Web Essentials (analogue of “Tools > Options > Web Essentials” menu item).
We are currently transitioning from vs 2013 to 2015, and the separation of bundling from webEssential will make our life quite hard because we cannot make it incrementally.
Working with typescript can be troublesome as the extension doesn't pick up changes to the compiled .js files, which means the bundled/minified file is not updated.
How can I enable processing of template scripts in a HTML file which is only minified and not included in any bundle?
A workaround which I found is to add an entry in bundleconfig.json with identical inputFiles and outputFile but i don't think this is the proper way to do it.
There are situations where the names of the parameters in functions are actually important (when dealing with certain types of APIs and when using AngularJS which requires this for dependency injection.
As such there is a need for a setting to prevent this change from occurring, and ideally a blanket 'no-rename' mode that simply removes comments/whitespace.
The scenario is as follows: I have an input.less
file which is compiled to an input.css
file. That input.css
file is the input for a bundle which outputs to output.css
.
When I update input.less
and save it, input.css
file gets updated. output.css
, however, does not get updated. When I open input.css
and save it without changing anything, output.css
is updated.
I'm not sure if this is, technically, an issue with Bundler & Minifier or with Web Compiler, but I assume the first, hence the issue here.
Add a button and a keyboard shortcut (Shift+Alt+I) to compile all specified files in the solution
When the output files are included in an input pattern, the output files from the previous bundle.js/bundle.min.js are included in the new bundle.js/bundle.min.js. This causes duplication and the file size keeps increasing. The output files should either be deleted before bundling or ignored while bundling.
Here is a failing unit test that reproduces the issue based on an existing unit test.
[TestMethod]
public void DontBundleOutputFile() {
_processor.Process("../../artifacts/globbingSubFolders.json");
_processor.Process("../../artifacts/globbingSubFolders.json");
string out2 = File.ReadAllText(new FileInfo("../../artifacts/globbing/out2.js").FullName);
Assert.AreEqual(out2, "var a = 1;\r\nvar b = 2;");
string out2Min = File.ReadAllText(new FileInfo("../../artifacts/globbing/out2.min.js").FullName);
Assert.AreEqual(out2Min, "var a=1,b=2");
}
Once a file has been minified, when changes to the source file are saved the .min (and corresponding .map file, see #4) should automatically be updated. This would be consistent with the behavior of earlier versions of Web Essentials.
In the current version, when you update the nuget package, you completely rewrite the Error and Import condition attribute. This causes a problem for us who want to only generate the bundles in specific configurations. For instance, if I want to generate the bundles only in release build, I would have to use this code:
<Import Project="..\packages\BuildBundlerMinifier.1.2.77\build\BuildBundlerMinifier.targets" Condition="Exists('..\packages\BuildBundlerMinifier.1.2.77\build\BuildBundlerMinifier.targets') And '$(Configuration)' == 'Release' " />
Notice the additional condition at the end. It would be great if you could detect those customization and keep them in place after an update.
This is to changes to files of a folder bundle Input source to cause a bundle update(in visual studio).
I actually think Recursive file globing should be supported as, but right now this fix is for the current top-diretory globbing support.
[
{
"outputFileName": "www/index.html",
"inputFiles": [
"app/_index_begin.html",
"app/_index.html",
"app/core/directives/login/", //---|
"app/core/directives/userprofile/", |
"app/core/directives/userphoto/", | recursive globbing would make this easier.
"app/core/directives/current-user-name/",//---|
/*...*/
"app/_index_end.html"
]
}
]
my PR: #18
Steps to reproduce:
I am using this within the context of a Cordova project and committing code in TFS 2013. Currently to work around this error, I copy out the contents of the bundleconfig.json file, delete it, create the new bundle, and manually edit the new bundleconfig.json file to include the copied contents.
Hi,
The bundled files do not adjust relative paths. Help.
Important comments are not preserved in minified scripts, e.g.:
//! This comment gets nuked
Interestingly however, important comments are maintained in minified stylesheets, e.g.:
/*! This comment gets kept */
The bundleconfig.json file is using the default settings in both cases:
{
"outputFileName": "Scripts/Foo.js",
"inputFiles": [
"Scripts/Foo.js"
]
},
{
"outputFileName": "Styles/Bar.css",
"inputFiles": [
"Styles/Bar.css"
]
}
Web Essentials 2013 had the option to compress bundles as gzip (.gz) automatically. It'd be nice to see this return.
I would like to be able to include all .js files in a folder except for test/spec files. It would be nice to have a way to ignore *spec.js or other types of files from the bundle.
Something like this would be great:
{
"outputFileName": "scripts/bundle.js",
"inputFiles": [
"scripts/**/*.js"
],
"ignoreFiles":[
"*spec.js",
"*.test.js"
],
"minify": {
"enabled": true
},
"sourceMaps": true
}
Hi,
I am trying to bundle and minify css and javascript files, javascript files bundle and minified perfectly fine but it's not the case with css, when I save bundleconfig.json it gives me the following error:
There was a error minifying custom.css
Any chance we could get support for glob patterns when defining inptuFiles? It would be nice if we could add a new file to a folder and not need to update my bundle.
Something along the lines of this:
{
"outputFileName": "dist/all.js",
"inputFiles": [
"app/**/*.js"
]},
I'm working on a project there we are using Web Essentials and it has been working like a breeze.
Now I suddenly have to install Bundler & Minifier and suddenly, it doesn't work anymore..
I'm working with AngularJS and this extension has problem with building some code when I'm using 'use strict' mode in javascript.
The error message is the following:
Error (Minifier) Strict-mode does not allow assignment to undefined variables: defered
I'm using Visual Studio 2015 RTM
Earlier versions of Web Essentials would create a .map file when minifying CSS (and JavaScript if I remember correctly). This extension does not currently create the corresponding .map file.
The extension hasn't been tested with ASP.NET 5 projects yet.
Hey,
Question - this extension does allow you to minify plain javascript files but the menu option doesn't show when you right-click on the nested js output of a typescript file - can that be added, so that those .js files can be minified as expected?
Particularly for scripts in debug mode it would be great to have HTML helper that used the same logic as the bundling service to insert a list of script elements (ie by parsing bundleconfig.json). When not debugging the helper would simply include a script element for the outputFile.
Alternatively the choice of whether to render the single bundle script or components could be at the discretion of the developer. Something like...
@Bundler.RenderScripts("/content/app/myBundle.js", HttpContext.Current.IsDebuggingEnabled)
I've hacked something (that works) together along these lines already but it would be make a lot more sense if it was part of this project so things like enumerating the files in folder worked identically.
Hi,
I would really like if you could add support for recursive directories as input files. I was thinking about something simple like this:
"inputFiles": [
"App/resursiveSearch/*",
"App/topLevelOnly/"
],
This would be really useful for our project. I could probably submit a PR if you are interested.
Hi, in web essentail 2013 there is a menu option "Re-minify all" for minifying all files in project.
This feature is missing in vs2015.
It's VERY IMPORTANT if the javascript files are build from other compilers (ex. TypeScript), or the project is shared with multiple developers because it allow to re minify all before build a release version.
Please put it back!
Thanks
I get the following error during minify:
(Minifier) Can't have 'break' outside of loop: break t
But that is possible in javascript.
Se the following example from http://www.w3schools.com/jsref/jsref_break.asp:
Using the break statement with a label reference, to "jump out" of a JavaScript code block:
var cars = ["BMW", "Volvo", "Saab", "Ford"];
var text = "";
list: {
text += cars[0] + "
";
text += cars[1] + "
";
text += cars[2] + "
";
break list;
text += cars[3] + "
";
}
The result of text will be:
BMW
Volvo
Saab
My files are CodePage 1252 and the Minifier mess the special characters when generate the .min.js
Would be nice if I could choose the Encoding and Line Ends for the minifier.
Have even tried deleting the contents of the file and creating bundles from scratch, but still getting the error when running Update bundle command.
After minifying a javascript file, concatenating several *.min.js files together and referencing the new concatenated javascript file, I receive a script error on the web page (primarily using IE, differs depending on the browser, but consistently errors). Referencing the minified stand-alone files individually on the webpage does not produce an error however. I believe I have traced the problem to the fact that the minified file drops the final semicolon, even when present in the original un-minified file. Adding the semicolon to the minified file and reconcatenating fixes the error.
You can recreate this issue by getting, for example, the Bootstrap NuGet package and choosing to minify the bootstrap.js file (with or without modifications). The original bootstrap.min.js file contains the closing semicolon, but after running "Minify File" it will not.
I have installed version 1.2.77 as mentioned in #47 but with the same results.
Is this a potential addition? Or should I just start looking at using gulp/grunt?
Now that globbing is supported (thank you), provide a menu option when right-clicking on a folder or project in Visual Studio. Menu should allow for js or css bundles and an option for recursive or non-recursive.
This is first non-pull-requested issue.
Should "BundlerMinifier" support input source recursive globing ?
[
{
"outputFileName": "www/index.html",
"inputFiles": [
"app/_index_begin.html",
"app/_index.html",
"app/core/, //all .html files in app.core and subfolders
"app/_index_end.html"
]
}
]
[
{
"outputFileName": "www/index.html",
"inputFiles": [
"app/_index_begin.html",
"app/_index.html",
"app/core/directives/login/", //---|
"app/core/directives/userprofile/", |
"app/core/directives/userphoto/", | recursive globbing would make this easier.
"app/core/directives/currentuser-name/",//---|
/*...*/
"app/_index_end.html"
]
}
]
this changed should be of minimal impact from what i´ve seen.
Just would like to change ideas before attempting to provide code changes.
This will make it very easy to see if the opened file is generated or not
I am using Visual Studio Community 2015. I am not seeing any source map files being generated. I have tried using 1.2.17, and the nightly build 1.2.73.
I have tried with the sourcemaps option set in the config file as well
[
{
"outputFileName": "Scripts/testbundle.js",
"inputFiles": [
"Scripts/test.js"
],
"includeInProject": true,
"sourceMaps": true
}
]
I am not sure how I can help figure out what is going on. If there is some kind of log or output I can send you please let me know how to get it and I will add them.
If you have "use strict"; as the first line in your js file it will fail to minify. As soon as I type anything else on a line before it the file minifies fine.
I'm using Bundler & Minifier 1.0.41
on Visual Studio 2015 RC on Windows 8.1
I'm afraid i don't really have much additional information to offer, and not sure how to diagnose better. I right-click on a .js, file in solution explorer of an MVC project, and select Minify, and then nothing happens. No error, nothing.
I've tried uninstalling and re-installing the extension with no difference.
Multiple bundleConfig.json files in various folders is supported, but they're not read on "Re-minify all bundles".
Right now a bundleConfig.json can be placed in a folder and can be compiled when right clicked, but "Bundle all" won't read it. I'd like "Re-minify all bundles" to use all bundleConfig.json files in the project.
We use externals so one bundleConfig.json on root is a bit cumbersome to handle.
If you minify a file that's stored in folder that contains a space (e.g. "Third Party"), then the following error dialog is displayed by the IDE:
"There is an error in the bundleconfig.json file. This could be due to a change in the format after this extension was updated."
The .min file doesn't get created, however the following entry still gets added to the bundleconfig.json file:
{
"outputFileName": "Third%20Party/Foo.css",
"inputFiles": [
"Third%20Party/Foo.css"
]
}
The %20 in the file path seems to be the issue here, because if you manually replace it with a space character and hit save, the .min file is generated and everything is hunky-dory.
I'm using VS2015 and latest version of BundleMinifier.
When I click Enable bundle on build I get the below exception in the Bundle & Minifier output window
10/09/2015 09:25:15: System.Net.WebException: The remote server returned an error: (404) Not Found.
at System.Net.HttpWebRequest.GetResponse()
at NuGet.RequestHelper.GetResponse()
at NuGet.HttpClient.GetResponse()
at NuGet.RedirectedHttpClient.GetResponseUri(HttpClient client)
at NuGet.RedirectedHttpClient.EnsureClient()
at System.Lazy1.CreateValue() at System.Lazy
1.LazyInitValue()
at System.Lazy1.get_Value() at NuGet.MemoryCache.GetOrAdd[T](Object cacheKey, Func
1 factory, TimeSpan expiration, Boolean absoluteExpiration)
at NuGet.RedirectedHttpClient.get_CachedClient()
at NuGet.RedirectedHttpClient.get_Uri()
at NuGet.DataServicePackageRepository.get_Source()
at NuGet.Protocol.Core.v2.DependencyInfoResourceV2.ResolvePackage(PackageIdentity package, NuGetFramework projectFramework, CancellationToken token)
at NuGet.PackageManagement.ResolverGather.d__27.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NuGet.PackageManagement.ResolverGather.d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NuGet.PackageManagement.ResolverGather.<>c__DisplayClass25_0.<b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NuGet.PackageManagement.ResolverGather.d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NuGet.PackageManagement.ResolverGather.d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at NuGet.PackageManagement.ResolverGather.d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NuGet.PackageManagement.ResolverGather.d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at NuGet.PackageManagement.NuGetPackageManager.d__36.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NuGet.PackageManagement.NuGetPackageManager.d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NuGet.VisualStudio.VsPackageInstaller.d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at NuGet.VisualStudio.VsPackageInstaller.d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
at NuGet.VisualStudio.VsPackageInstaller.InstallPackage(String source, Project project, String packageId, Version version, Boolean ignoreDependencies)
at BundlerMinifierVsix.Commands.BundleOnBuild.<>c__DisplayClass11_1.b__0(Object o) in C:\projects\bundlerminifier\src\BundlerMinifierVsix\Commands\BundleOnBuild.cs:line 113
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.