Bundle ... Para-para-pa Hey! or Bundle Transformer walks on planet 2
I will deviate a bit from the format of the previous article and before making a selection of interesting references to the Bundle Transformer , I will talk about the changes that have occurred in the project over the past six months.
Until August last year, the dotless library was the main tool for working with LESS in the community .NET developer, and was part of almost all client optimization tools for ASP.NET: Cassette , SquishIt , Combres and RequestReduce . Bundle Transformer was also no exception: the dotless and DotlessClientOnly libraries (lite version) were used in the BundleTransformer.Less and BundleTransformer.LessLite modules. ')
The situation changed radically when Twitter Bootstrap 3.0 was released . The source of the Bootstrap 3.0 style sheets was written in LESS 1.4.X, and the dotless library at that time supported an older version of LESS (support for LESS 1.4.X appeared in dotless only in December 2013). In fact, all the listed tools for working with LESS suddenly became obsolete. In order to remedy the situation, I decided to implement in the BundleTransformer.Less and BundleTransformer.LessLite modules my own version of the LESS compiler based on the source code of the less.js project. By that time, I already had a lot of experience creating compilers (compilers) and minimizers based on Node.js libraries (modules BundleTransformer.CoffeeScript , BundleTransformer.TypeScript , BundleTransformer.UglifyJs and BundleTransformer.Csso ). Initially, the updated modules BundleTransformer.Less and BundleTransformer.LessLite used the MSIE JavaScript Engine for .Net library as a JavaScript engine, but as these modules grew in popularity I began to receive many messages from users who asked me to refuse MSIE JavaScript Engine for .Net and use instead one of the implementations of the V8 engine for .NET. So I started working on my new project - JavaScript Engine Switcher .
JavaScript Engine Switcher is a .NET library that defines a unified interface for accessing the basic features of popular JavaScript engines:
MSIE JavaScript Engine for .Net
V8 (originally, the Noesis Javascript .NET library was used as an implementation of the engine, but due to poor compatibility with 64-bit versions of IIS 8.X, it was replaced with a more modern library — Microsoft ClearScript.V8 )
JavaScript Engine Switcher allows you to easily and quickly switch any .NET project to use another JavaScript engine. In addition, you have the opportunity to connect your favorite JavaScript-engine using JavaScript Engine Switcher. To do this, you need to write an adapter that implements the IJsEngine interface or inherits the JsEngineBase class from the JavaScriptEngineSwitcher.Core namespace, and then register it in the \configuration\jsEngineSwitcher\core\engines element of the configuration file ( Web.config or App.config ).
Starting from version 1.8.0, all Bundle Transformer modules, created on the basis of the code of JavaScript libraries, began to use the JavaScript Engine Switcher. The development of the BundleTransformer.LessLite module was discontinued because he was no different from BundleTransformer.Less. The ability to use the V8 engine allowed us to create a module BundleTransformer.CleanCss based on the Clean-css project code.
The lack of direct dependence on Internet Explorer and support for the latest versions of LESS (currently supported by LESS 1.6.1) allowed Bundle Transformer to bypass all its competitors and take 21st place in the ASP.NET category of the NuGet Gallery website rating. The constant influx of new users has contributed to the emergence of relevant technical articles about the Bundle Transformer:
Now let's move on to a selection of the most prominent references to the Bundle Transformer:
1. The 77th edition of the Internet radio show Code Name "APS"
In the previous article I already talked about the 21st edition of the radio show Code Name "APS" on Binary Radio , in the air of which local DJs reviewed Bundle Transformer 1.6.5. This time I was lucky to be a guest of the 77th edition of this radio show. I mainly talked about Bundle Transformer and WebMarkupMin , but during the discussion the following topics were also covered: WebMatrix, ASP.NET Web Pages, Web Essentials 2013, TypeScript, Windows 8 and web services. You can listen to the recording of this radio program in the Binary Radio group on the social network VKontakte or download it as an MP3 file .
2. Presentation of the Optimus expansion at the conference “Umbraco UK Fest 2013”
Optimus is an extension for CMS Umbraco , based on the Microsoft ASP.NET Web Optimization Framework and Bundle Transformer. This extension allows front-end developers who are not familiar with C # or VB.NET to create bundles via the Umbraco administrative interface. Also for Optimus there are additional modules (providers) that allow you to add support for intermediate languages: LESS, Sass / SCSS, CoffeeScript and TypeScript.
It is worth noting that the authors of the extension (Tim Geisssens and Warren Buckley) very creatively approached the choice of its name. The name "Optimus" simultaneously beats the names of two basic products:
It is consonant with the word "Optimization" from the Microsoft ASP.NET Web Optimization Framework.
It coincides with the name of one of the main characters of the Transformers universe - Optimus Prime .
3. Pluralsight's ASP.NET Bundling, Minification & Resource Optimization Training Course
Travis Gosselin’s “ASP.NET Bundling, Minification & Resource Optimization” training course contains almost comprehensive information on working with the Microsoft ASP.NET Web Optimization Library (only the topic of using this library in ASP.NET Web Pages was not covered). Previously, such information had to be collected bit by bit: read the official documentation , follow the Howard Dorking blog , look for answers to Stack Overflow, and even study the System.Web.Optimization.dll assembly code using a decompiler.
As you have already guessed, in such a large course there was a place for the Bundle Transformer. Two videos are dedicated to working with the Bundle Transformer:
In the video clip “Demo: Bundle Transformer Package”, the author of the course, using the example of installing and configuring the BundleTransformer.Less and BundleTransformer.Yui modules, explains the basic principles of working with the Bundle Transformer and gives the following code example:
bundles.Add(new Bundle("~/bundles/app", new JsTransformer()) .IncludeDirectory("~/Scripts/app", "*.js")); bundles.Add(new Bundle("~/styles/site", new CssTransformer()).Include( "~/Content/bootstrap/bootstrap.css", "~/Content/site.less", "~/Content/toastr.css"));
In principle, this is a valid code, but it can be made more productive if you use an instance of the NullBuilder class as the default code NullBuilder :
var nullBuilder = new NullBuilder(); bundles.Add(new Bundle("~/bundles/app", new JsTransformer()) { Builder = nullBuilder } .IncludeDirectory("~/Scripts/app", "*.js")); bundles.Add(new Bundle("~/styles/site", new CssTransformer()) { Builder = nullBuilder } .Include( "~/Content/bootstrap/bootstrap.css", "~/Content/site.less", "~/Content/toastr.css"));
In addition, the scope of this code can be reduced by using the CustomScriptBundle and CustomStyleBundle :
Despite the fact that I have been using the Microsoft ASP.NET Web Optimization Framework for a long time and I know its internal structure well, I was able to emphasize a lot of new things from this course (especially from the last two modules: “Architecting Optimizations” and “Testing Optimizations”).
Conclusion
In conclusion, I would like to thank all the technical specialists who help me promote the Bundle Transformer to the masses.