Compiling a bundle as separate file with Closure times-out

Jun 25, 2014 at 1:26 AM
Edited Jun 25, 2014 at 1:27 AM
I was expecting that this minifier would produce a single file first then run it through the google compiler. For my bundle this should take about 10 seonds but it takes more than 2 minutes and usually times out the web request.

I've tried commenting out the builder;
                //var nullBuilder = new NullBuilder();
                var styleTransformer = new StyleTransformer();
                var scriptTransformer = new ScriptTransformer(new[]{"/AngularJS/*"});
                var nullOrderer = new NullOrderer();

                //ngBundle.Builder = nullBuilder;
                ngBundle.Transforms.Add(scriptTransformer);
                ngBundle.Orderer = nullOrderer;

                bundles.Add(ngBundle);
However, it's still running Java.exe as many times as there are files in the bundle. Not only is this slow but presumably it's over-optimising and removing functions it shouldn't because it can't see the whole file in context.

How can I get it to process the entire bundle as a single concatenated file?
Coordinator
Jun 25, 2014 at 6:01 AM
Hello, Daniel!
How can I get it to process the entire bundle as a single concatenated file?
It's impossible. This peculiarity of the Bundle Transformer architecture.
Coordinator
Jun 25, 2014 at 6:25 AM
Perhaps in the future to appear combineBeforeMinification option. But this will require serious architectural changes.
Jun 25, 2014 at 9:02 AM

Hi Taritsyn

Great work on the framework by the way, but Wow! “Impossible” is not the answer I’d expected or hoped for!

So the “Builders” only work after the minification? Is there no combination of pre-processor, builder, transformer or pre-reading you can think of that would work around this? Pre-reading the files from disk into a single text file seems like it conflicts with the architecture at first glance.

Might there be another way to override the bundles programmatically? Otherwise ADVANCED_OPTIMISATIONS surely can’t work effectively, not to mention the time-out issue.

Thanks

daniel

Coordinator
Jun 25, 2014 at 9:45 AM
Might there be another way to override the bundles programmatically? Otherwise ADVANCED_OPTIMISATIONS surely can’t work effectively, not to mention the time-out issue.
I answered this in the second comment.

Regarding a processing of assets separately. If you read the project description, then probably saw that the Bundle Transformer has one important feature:
The main differences of StyleTransformer and ScriptTransformer classes from a standard implementations: ability to exclude unnecessary assets when adding assets from a directory, does not produce the re-minification of pre-minified assets, support automatic transformation of relative paths to absolute in CSS-code (by using UrlRewritingCssPostProcessor), etc.
It is because of this feature has been chosen this architecture.
Jun 25, 2014 at 9:57 AM

I’m just trying to see if I can get that to work now. The Closure compiler is too slow to work with individual files in my case, but I notice that you ship a MicrosoftAjaxMinifier replacement for JsMinify(). I’m hoping I can use that instead and bundle some pre-miniified files. Those files already have a *.min.js extension, so I want to swap in your transformer here;

// Microsoft's Ajax Standard Minifier

ngBundle.Transforms.Add(new JsMinify());

but BundleTransformer.MicrosoftAjax.Minifiers.MicrosoftAjaxJsMinifier doesn’t seem to support IBundlerTransformer. Are there any docs on integrating this?

Coordinator
Jun 25, 2014 at 10:04 AM
Two quotes from the documentation:
Classes StyleTransformer and ScriptTransformer, included in the core of Bundle Transformer and implement interface IBundleTransform. They are intended to replace the standard classes CssMinify and JsMinify.

You also need to understand that when you plug instances of StyleTransformer and ScriptTransformer classes, then you plug in a set of transformations (choice between debug and pre-minified versions of files, translation code from the intermediate languages, runtime code minification, transformation of relative paths to absolute (only for CSS-code) and code combining). A set of transformations depends on what the modules of Bundle Transformer you have installed and settings you have specified in the Web.config file.
Coordinator
Jun 25, 2014 at 8:28 PM
In Bundle Transformer 1.9.1 was solved this problem.
Jun 26, 2014 at 9:43 AM

Awesome! So it’s not “impossible” then ;-P

thanks