SlideShare una empresa de Scribd logo
1 de 29
ASP.NET Web Optimization withCOMBRES Buu Nguyen
Buu Nguyen Director of Technology, KMS Technology, www.kms-technology.com Lecturer, RMIT Vietnam, www.rmit.edu.vn www.buunguyen.net/blog Twitter: buunguyen
Combres optimizes your web apps by combining,minifying,compressing, caching, and enhancingCSS & JavaScript resources before sending them to browser
Agenda Combres Overview Beyond Simple Usage Filtering Architecture Minification Architecture Future Direction Appendix – Combres Quickly
Life Without Combres
Define Combres Resource Sets
HTTP Response Combine, Cache, Compress Original CSS size is 33KB – a 85% size decrease Minify
Beyond Simple Usages
A Couple of Issues
Updated Combres Data File
Auto-Versioning You’ve just seen auto-versioning in action Automatically detects changes to Addition/removal of resources in a set Contents of static/dynamic resources  Applied filters & their parameters Applied minifier & its parameters Can switch version generation algorithm Turn-on once, and never have to touch the data file to modify version again
Filtering Architecture
Intercept Combres Pipeline Read Resource Filter Filter Filter Filter Filter Filter Filter Filter invokes Combine Resources invokes Minify Combination invokes Compress Combination invokes
CSS-Variable Filter @define { background: #5c87b2; font-family: Verdana,Helvetica,Sans-Serif; } body { background-color: @background; font-family: @font-family;  font-size: .75em; } /** more CSS... **/ body { background-color: #5c87b2; font-family: Verdana,Helvetica,Sans-Serif;  font-size: .75em; } /** more CSS... **/
publicsealedclassHandleCssVariablesFilter : ISingleContentFilter { ///<inheritdoccref="IContentFilter.CanApplyTo" /> publicboolCanApplyTo(ResourceTyperesourceType)     { returnresourceType == ResourceType.CSS;     } ///<inheritdoccref="ISingleContentFilter.TransformContent" /> publicstringTransformContent(Settingssettings, Resourceresource, string content)     { if (!CanApplyTo(resource.ParentSet.Type)) thrownewArgumentException("Filter can't be applied to " +  resource.ParentSet.Type); // Remove comments because they may mess up the result         content = Regex.Replace(content, @"/.*?/", string.Empty,  RegexOptions.Singleline); varregex = newRegex(@"@define*{(?<define>.*?)}", RegexOptions.Singleline); var match = regex.Match(content); if (!match.Success) return content; var value = match.Groups["define"].Value; var variables = value.Split(';'); varsb = newStringBuilder(content); variables.ToList().ForEach(variable =>                       { if (string.IsNullOrEmpty(variable.Trim())) return; var pair = variable.Split(':'); sb.Replace("@" + pair[0].Trim(), pair[1].Trim());                       }); // Remove the variables declaration, it's not needed in the final output sb.Replace(match.ToString(), string.Empty); returnsb.ToString();     } }
Minification Architecture
Minification By default, .NET YUI Compressor library is used for JS & CSS minification Alternative built-in minifiers Google Closure (JS only) MS Ajax Minifier (JS only) It’s also possible to add your own minifier
Built-in Minifiers <cssMinifiers>   <minifiername="yui"type="Combres.Minifiers.YuiCssMinifier, Combres">     <paramname="CssCompressionType"type="string"value="StockYuiCompressor" />     <paramname="ColumnWidth"type="int"value="-1" />   </minifier> </cssMinifiers> <jsMinifiers>   <minifiername="yui"type="Combres.Minifiers.YuiJSMinifier, Combres">     <paramname="IsVerboseLogging"type="bool"value="false" />     <paramname="IsObfuscateJavascript"type="bool"value="true" />     <paramname="PreserveAllSemicolons"type="bool"value="false" />     <paramname="DisableOptimizations"type="bool"value="false" />     <paramname="LineBreakPosition"type="int"value="-1" />   </minifier>   <minifiername="msajax"type="Combres.Minifiers.MSAjaxJSMinifier, Combres" binderType="Combres.Binders.SimpleObjectBinder, Combres">     <paramname="CollapseToLiteral"type="bool"value="true" />     <paramname="EvalsAreSafe"type="bool"value="true" />     <paramname="LocalRenaming"type="Microsoft.Ajax.Utilities.LocalRenaming, ajaxmin" value="CrunchAll" />     <paramname="OutputMode"type="Microsoft.Ajax.Utilities.OutputMode, ajaxmin"            value="SingleLine" />     <paramname="RemoveUnneededCode"type="bool"value="true" />     <paramname="StripDebugStatements"type="bool"value="true" />   </minifier>   <minifiername="closure"type="Combres.Minifiers.ClosureJSMinifier, Combres">     <paramname="ApiUrl"type="string" value="http://closure-compiler.appspot.com/compile" />     <paramname="CompilationLevel"type="string"value="ADVANCED_OPTIMIZATIONS" />   </minifier> </jsMinifiers>
Using Minifiers
///<summary> /// CSS minifier which delegates the minification process to the /// YUI Compressor library (http://yuicompressor.codeplex.com/). ///</summary> publicsealedclassYuiCssMinifier : IResourceMinifier, IParametersReceiver { ///<inheritdoccref="IParametersReceiver.Binder" /> publicIObjectBinder Binder { get; set; } ///<inheritdoccref="IParametersReceiver.Parameters" /> publicIList<XElement> Parameters { get; set; } publicstringCssCompressionType { get; set; } publicint? ColumnWidth { get; set; } ///<inheritdoccref="IResourceMinifier.Minify" /> publicstring Minify(Settingssettings, ResourceSetrs,  stringcombinedContent)     { Binder.Bind(Parameters, this); var type = (CssCompressionType)CssCompressionType.ConvertToType( typeof(CssCompressionType),  Yahoo.Yui.Compressor.CssCompressionType.StockYuiCompressor); returnCssCompressor.Compress(combinedContent,  ColumnWidth == null ? -1 : ColumnWidth.Value,             type);     } }
Future Direction
Future Direction Pluggable cache provider Velocity, DB Filter to support CSS expression Pipeline optimization Allow disable compression Idea?  Bug?  Feature?  Contribution? http://combres.codeplex.com/Thread/List.aspx http://combres.codeplex.com/WorkItem/List.aspx http://combres.codeplex.com/SourceControl/UploadPatch.aspx
Download Combres 1.2 http://combres.codeplex.com Download include Binary (.NET 3.5) and referenced libraries Source code & CHM doc Sample code Sample data files (with annotation) Licensed under Apache 2.0
Appendix - Combres Quickly
Step 1. Add References Red: required DLLs Blue: optional DLLs
Step 2. Modify web.config
Step 3. Create Combres Data File
Step 4. Register Route in global.ascx
Step 5. Link to Resource Sets

Más contenido relacionado

La actualidad más candente

Using correlation in loadrunner 80
Using correlation in loadrunner 80Using correlation in loadrunner 80
Using correlation in loadrunner 80
medsherb
 
Apache Camel - WJax 2008
Apache Camel - WJax 2008Apache Camel - WJax 2008
Apache Camel - WJax 2008
inovex GmbH
 
Rails 3 generators
Rails 3 generatorsRails 3 generators
Rails 3 generators
joshsmoore
 

La actualidad más candente (20)

JSP Custom Tags
JSP Custom TagsJSP Custom Tags
JSP Custom Tags
 
Using correlation in loadrunner 80
Using correlation in loadrunner 80Using correlation in loadrunner 80
Using correlation in loadrunner 80
 
Testing Ruby with Rspec (a beginner's guide)
Testing Ruby with Rspec (a beginner's guide)Testing Ruby with Rspec (a beginner's guide)
Testing Ruby with Rspec (a beginner's guide)
 
Apache Camel - WJax 2008
Apache Camel - WJax 2008Apache Camel - WJax 2008
Apache Camel - WJax 2008
 
Creating native apps with WordPress
Creating native apps with WordPressCreating native apps with WordPress
Creating native apps with WordPress
 
Form validation client side
Form validation client side Form validation client side
Form validation client side
 
RSpec and Rails
RSpec and RailsRSpec and Rails
RSpec and Rails
 
Prototype js
Prototype jsPrototype js
Prototype js
 
Ruby on Rails testing with Rspec
Ruby on Rails testing with RspecRuby on Rails testing with Rspec
Ruby on Rails testing with Rspec
 
Java script basics
Java script basicsJava script basics
Java script basics
 
Template Toolkit
Template ToolkitTemplate Toolkit
Template Toolkit
 
Rails 3 generators
Rails 3 generatorsRails 3 generators
Rails 3 generators
 
JSP custom tags
JSP custom tagsJSP custom tags
JSP custom tags
 
Form validation server side
Form validation server side Form validation server side
Form validation server side
 
Symfony 4 Workshop - Limenius
Symfony 4 Workshop - LimeniusSymfony 4 Workshop - Limenius
Symfony 4 Workshop - Limenius
 
Ember - introduction
Ember - introductionEmber - introduction
Ember - introduction
 
Haml & Sass presentation
Haml & Sass presentationHaml & Sass presentation
Haml & Sass presentation
 
iOS best practices
iOS best practicesiOS best practices
iOS best practices
 
W2Tags Is Haml In Erb
W2Tags Is Haml In ErbW2Tags Is Haml In Erb
W2Tags Is Haml In Erb
 
Grails basics part2
Grails basics  part2Grails basics  part2
Grails basics part2
 

Similar a Combres

Building Web Interface On Rails
Building Web Interface On RailsBuilding Web Interface On Rails
Building Web Interface On Rails
Wen-Tien Chang
 
Krazykoder struts2 plugins
Krazykoder struts2 pluginsKrazykoder struts2 plugins
Krazykoder struts2 plugins
Krazy Koder
 
Php Reusing Code And Writing Functions
Php Reusing Code And Writing FunctionsPhp Reusing Code And Writing Functions
Php Reusing Code And Writing Functions
mussawir20
 
Flex For Flash Developers Ff 2006 Final
Flex For Flash Developers Ff 2006 FinalFlex For Flash Developers Ff 2006 Final
Flex For Flash Developers Ff 2006 Final
ematrix
 
Lecture 3 - Comm Lab: Web @ ITP
Lecture 3 - Comm Lab: Web @ ITP Lecture 3 - Comm Lab: Web @ ITP
Lecture 3 - Comm Lab: Web @ ITP
yucefmerhi
 

Similar a Combres (20)

Beholding the giant pyramid of application development; why Ajax applications...
Beholding the giant pyramid of application development; why Ajax applications...Beholding the giant pyramid of application development; why Ajax applications...
Beholding the giant pyramid of application development; why Ajax applications...
 
Struts2
Struts2Struts2
Struts2
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Riding Apache Camel
Riding Apache CamelRiding Apache Camel
Riding Apache Camel
 
EPiServer Web Parts
EPiServer Web PartsEPiServer Web Parts
EPiServer Web Parts
 
Building Web Interface On Rails
Building Web Interface On RailsBuilding Web Interface On Rails
Building Web Interface On Rails
 
Krazykoder struts2 plugins
Krazykoder struts2 pluginsKrazykoder struts2 plugins
Krazykoder struts2 plugins
 
Introduction To Lamp
Introduction To LampIntroduction To Lamp
Introduction To Lamp
 
Component and Event-Driven Architectures in PHP
Component and Event-Driven Architectures in PHPComponent and Event-Driven Architectures in PHP
Component and Event-Driven Architectures in PHP
 
Spring Capitulo 05
Spring Capitulo 05Spring Capitulo 05
Spring Capitulo 05
 
Php Reusing Code And Writing Functions
Php Reusing Code And Writing FunctionsPhp Reusing Code And Writing Functions
Php Reusing Code And Writing Functions
 
Interoperable Web Services with JAX-WS
Interoperable Web Services with JAX-WSInteroperable Web Services with JAX-WS
Interoperable Web Services with JAX-WS
 
2 Asp Dot Net Ajax Extensions
2 Asp Dot Net Ajax Extensions2 Asp Dot Net Ajax Extensions
2 Asp Dot Net Ajax Extensions
 
DevDays09 Internet Explorer 8
DevDays09 Internet Explorer 8DevDays09 Internet Explorer 8
DevDays09 Internet Explorer 8
 
Flex For Flash Developers Ff 2006 Final
Flex For Flash Developers Ff 2006 FinalFlex For Flash Developers Ff 2006 Final
Flex For Flash Developers Ff 2006 Final
 
ASP.NET MVC introduction
ASP.NET MVC introductionASP.NET MVC introduction
ASP.NET MVC introduction
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalyst
 
Lecture 3 - Comm Lab: Web @ ITP
Lecture 3 - Comm Lab: Web @ ITP Lecture 3 - Comm Lab: Web @ ITP
Lecture 3 - Comm Lab: Web @ ITP
 
Sencha Touch Intro
Sencha Touch IntroSencha Touch Intro
Sencha Touch Intro
 
Php
PhpPhp
Php
 

Más de Buu Nguyen (11)

On Becoming a Technical Lead
On Becoming a Technical LeadOn Becoming a Technical Lead
On Becoming a Technical Lead
 
C# 3.0 and 4.0
C# 3.0 and 4.0C# 3.0 and 4.0
C# 3.0 and 4.0
 
Stories about KMS Technology
Stories about KMS TechnologyStories about KMS Technology
Stories about KMS Technology
 
ASP.NET MVC 3
ASP.NET MVC 3ASP.NET MVC 3
ASP.NET MVC 3
 
HTML5 in IE9
HTML5 in IE9HTML5 in IE9
HTML5 in IE9
 
Dynamic Binding in C# 4.0
Dynamic Binding in C# 4.0Dynamic Binding in C# 4.0
Dynamic Binding in C# 4.0
 
ASP.NET MVC 2.0
ASP.NET MVC 2.0ASP.NET MVC 2.0
ASP.NET MVC 2.0
 
Building Scalable .NET Web Applications
Building Scalable .NET Web ApplicationsBuilding Scalable .NET Web Applications
Building Scalable .NET Web Applications
 
New Features of ASP.NET 4.0
New Features of ASP.NET 4.0New Features of ASP.NET 4.0
New Features of ASP.NET 4.0
 
C# 4.0 and .NET 4.0
C# 4.0 and .NET 4.0C# 4.0 and .NET 4.0
C# 4.0 and .NET 4.0
 
Fasterflect
FasterflectFasterflect
Fasterflect
 

Último

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Combres

  • 1. ASP.NET Web Optimization withCOMBRES Buu Nguyen
  • 2. Buu Nguyen Director of Technology, KMS Technology, www.kms-technology.com Lecturer, RMIT Vietnam, www.rmit.edu.vn www.buunguyen.net/blog Twitter: buunguyen
  • 3. Combres optimizes your web apps by combining,minifying,compressing, caching, and enhancingCSS & JavaScript resources before sending them to browser
  • 4. Agenda Combres Overview Beyond Simple Usage Filtering Architecture Minification Architecture Future Direction Appendix – Combres Quickly
  • 7. HTTP Response Combine, Cache, Compress Original CSS size is 33KB – a 85% size decrease Minify
  • 9. A Couple of Issues
  • 11. Auto-Versioning You’ve just seen auto-versioning in action Automatically detects changes to Addition/removal of resources in a set Contents of static/dynamic resources Applied filters & their parameters Applied minifier & its parameters Can switch version generation algorithm Turn-on once, and never have to touch the data file to modify version again
  • 13. Intercept Combres Pipeline Read Resource Filter Filter Filter Filter Filter Filter Filter Filter invokes Combine Resources invokes Minify Combination invokes Compress Combination invokes
  • 14. CSS-Variable Filter @define { background: #5c87b2; font-family: Verdana,Helvetica,Sans-Serif; } body { background-color: @background; font-family: @font-family; font-size: .75em; } /** more CSS... **/ body { background-color: #5c87b2; font-family: Verdana,Helvetica,Sans-Serif; font-size: .75em; } /** more CSS... **/
  • 15. publicsealedclassHandleCssVariablesFilter : ISingleContentFilter { ///<inheritdoccref="IContentFilter.CanApplyTo" /> publicboolCanApplyTo(ResourceTyperesourceType) { returnresourceType == ResourceType.CSS; } ///<inheritdoccref="ISingleContentFilter.TransformContent" /> publicstringTransformContent(Settingssettings, Resourceresource, string content) { if (!CanApplyTo(resource.ParentSet.Type)) thrownewArgumentException("Filter can't be applied to " + resource.ParentSet.Type); // Remove comments because they may mess up the result content = Regex.Replace(content, @"/.*?/", string.Empty, RegexOptions.Singleline); varregex = newRegex(@"@define*{(?<define>.*?)}", RegexOptions.Singleline); var match = regex.Match(content); if (!match.Success) return content; var value = match.Groups["define"].Value; var variables = value.Split(';'); varsb = newStringBuilder(content); variables.ToList().ForEach(variable => { if (string.IsNullOrEmpty(variable.Trim())) return; var pair = variable.Split(':'); sb.Replace("@" + pair[0].Trim(), pair[1].Trim()); }); // Remove the variables declaration, it's not needed in the final output sb.Replace(match.ToString(), string.Empty); returnsb.ToString(); } }
  • 17. Minification By default, .NET YUI Compressor library is used for JS & CSS minification Alternative built-in minifiers Google Closure (JS only) MS Ajax Minifier (JS only) It’s also possible to add your own minifier
  • 18. Built-in Minifiers <cssMinifiers> <minifiername="yui"type="Combres.Minifiers.YuiCssMinifier, Combres"> <paramname="CssCompressionType"type="string"value="StockYuiCompressor" /> <paramname="ColumnWidth"type="int"value="-1" /> </minifier> </cssMinifiers> <jsMinifiers> <minifiername="yui"type="Combres.Minifiers.YuiJSMinifier, Combres"> <paramname="IsVerboseLogging"type="bool"value="false" /> <paramname="IsObfuscateJavascript"type="bool"value="true" /> <paramname="PreserveAllSemicolons"type="bool"value="false" /> <paramname="DisableOptimizations"type="bool"value="false" /> <paramname="LineBreakPosition"type="int"value="-1" /> </minifier> <minifiername="msajax"type="Combres.Minifiers.MSAjaxJSMinifier, Combres" binderType="Combres.Binders.SimpleObjectBinder, Combres"> <paramname="CollapseToLiteral"type="bool"value="true" /> <paramname="EvalsAreSafe"type="bool"value="true" /> <paramname="LocalRenaming"type="Microsoft.Ajax.Utilities.LocalRenaming, ajaxmin" value="CrunchAll" /> <paramname="OutputMode"type="Microsoft.Ajax.Utilities.OutputMode, ajaxmin" value="SingleLine" /> <paramname="RemoveUnneededCode"type="bool"value="true" /> <paramname="StripDebugStatements"type="bool"value="true" /> </minifier> <minifiername="closure"type="Combres.Minifiers.ClosureJSMinifier, Combres"> <paramname="ApiUrl"type="string" value="http://closure-compiler.appspot.com/compile" /> <paramname="CompilationLevel"type="string"value="ADVANCED_OPTIMIZATIONS" /> </minifier> </jsMinifiers>
  • 20. ///<summary> /// CSS minifier which delegates the minification process to the /// YUI Compressor library (http://yuicompressor.codeplex.com/). ///</summary> publicsealedclassYuiCssMinifier : IResourceMinifier, IParametersReceiver { ///<inheritdoccref="IParametersReceiver.Binder" /> publicIObjectBinder Binder { get; set; } ///<inheritdoccref="IParametersReceiver.Parameters" /> publicIList<XElement> Parameters { get; set; } publicstringCssCompressionType { get; set; } publicint? ColumnWidth { get; set; } ///<inheritdoccref="IResourceMinifier.Minify" /> publicstring Minify(Settingssettings, ResourceSetrs, stringcombinedContent) { Binder.Bind(Parameters, this); var type = (CssCompressionType)CssCompressionType.ConvertToType( typeof(CssCompressionType), Yahoo.Yui.Compressor.CssCompressionType.StockYuiCompressor); returnCssCompressor.Compress(combinedContent, ColumnWidth == null ? -1 : ColumnWidth.Value, type); } }
  • 22. Future Direction Pluggable cache provider Velocity, DB Filter to support CSS expression Pipeline optimization Allow disable compression Idea? Bug? Feature? Contribution? http://combres.codeplex.com/Thread/List.aspx http://combres.codeplex.com/WorkItem/List.aspx http://combres.codeplex.com/SourceControl/UploadPatch.aspx
  • 23. Download Combres 1.2 http://combres.codeplex.com Download include Binary (.NET 3.5) and referenced libraries Source code & CHM doc Sample code Sample data files (with annotation) Licensed under Apache 2.0
  • 25. Step 1. Add References Red: required DLLs Blue: optional DLLs
  • 26. Step 2. Modify web.config
  • 27. Step 3. Create Combres Data File
  • 28. Step 4. Register Route in global.ascx
  • 29. Step 5. Link to Resource Sets