Git Product home page Git Product logo

bundlerminifier's People

Contributors

ahmedalejo avatar cnblogs-dudu avatar dammitjanet avatar deinok avatar duncansmart avatar ealsur avatar i-love-code avatar imatoria avatar josejamesp avatar jtone123 avatar madskristensen avatar martincostello avatar meziantou avatar mlorbetske avatar natemcmaster avatar nelsonreis avatar nicolasdorier avatar rockstardev avatar rsaladrigas avatar sarahcrissman avatar scott-xu avatar scottaddie avatar starpeng avatar stebueh avatar supershowwei avatar taritsyn avatar theboringcoder avatar tonher31 avatar vahidn avatar vnefedov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bundlerminifier's Issues

Bundle cascade usage

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

Min Js with SourceMap has extra line.

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).

UI for configuring of minification options

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).

Make it available for vs2013

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.

Bundle/Minify compiled files on build

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.

ProcessableScriptTypeList for single minified (not bundled) HTML file

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.

Option for the minifier not to rename function parameters.

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.

Bundling is not performed when an input file is updated by another tool

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.

Don't Bundle Output Files When Globbling

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");
        }

Enable automatic minification

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.

Improvement in the project update process

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.

Support Folder Bundle Update On Save

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

"Unable to add project item" when adding more bundles

Steps to reproduce:

  1. Open a solution that already has bundles
  2. Create and save a new bundle
  3. Receive error:
    "Unable to add project item
    [path to bundleconfig.json]
    ADDRESULT_Cancel"

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.

Important comments not preserved n JS files

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"
    ]
  }

Option to gzip bundles.

Web Essentials 2013 had the option to compress bundles as gzip (.gz) automatically. It'd be nice to see this return.

Provide Ignore Files Pattern

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
}

There was a error minifying

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

Globbing Support?

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"
 ]},

Cannot bundle AngularJS

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

Wrong encoding

Since version 1.2.71 the output file has wrong encoding.
The following image shows the problem.
The row in RED shows the (CORRECT) behaviour of previous version.
The row in GREEN shows the (WRONG) behaviour of current 1.2.71 version.
encoding

Missing menu option for .js

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?

Provide a HTML helper to add the individual bundles InputFiles when in debug mode

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.

Support recursive directories

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.

Re-minify all missing!

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

Can't have 'break' outside of loop

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

Error in minified .js file

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.

Minify on Build

Is this a potential addition? Or should I just start looking at using gulp/grunt?

Provide Menu Support For Folders

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.

Input File Recursive Globing Support

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.

Source Map Files Are Not Generating

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.

JS Minification and "use strict";

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

Minification not working - VS 2015 Community

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.

bundleConfig.json not on root is not used with "Re-minify all bundles…".

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.

Minifying files in folders that contains spaces

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.

Getting 404 Not found when trying to enable Bundle on Build

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.Lazy1.LazyInitValue()
at System.Lazy1.get_Value() at NuGet.MemoryCache.GetOrAdd[T](Object cacheKey, Func1 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.