-
Notifications
You must be signed in to change notification settings - Fork 47
ASP.NET Extensions
Prior to WebMarkupMin version 2.0, configuring of ASP.NET extensions were made by using the Web.config
file. Now during configuration instead of the declarative approach (using the configuration file) is used in the imperative approach (using the program code).
The rejection of the declarative approach was due to the following reasons:
- Microsoft for several years, uses an imperative approach for configuration of individual parts of ASP.NET (for example, Web API or Web Optimization Framework).
- ASP.NET 5 no longer supports the
Web.config
files.
Extensions for ASP.NET 4.X and ASP.NET 5 use different configuration models. In ASP.NET 4.X configuring of extensions are made through special classes: WebMarkupMinConfiguration
, HtmlMinificationManager
, XhtmlMinificationManager
and XmlMinificationManager
. In ASP.NET 5 configuration of extension is based on the Options framework and using the following classes: WebMarkupMinOptions
, HtmlMinificationOptions
, XhtmlMinificationOptions
and XmlMinificationOptions
. However, these configuration models have a lot in common.
WebMarkupMinConfiguration
and WebMarkupMinOptions
classes inherit WebMarkupMinConfigurationBase
class, which has the following properties:
Property name | Data type | Default value | Description |
---|---|---|---|
DisableMinification |
Boolean | false |
Flag for whether to disable markup minification. |
DisableCompression |
Boolean | false |
Flag for whether to disable HTTP compression of content. |
MaxResponseSize |
Int32 | -1 |
Maximum size of the response (in bytes), in excess of which disables the minification of markup. If this property is set equal to -1 , then checking of the response size is not performed.
|
DisablePoweredByHttpHeaders |
Boolean | false |
Flag for whether to disable the *-Minification-Powered-By HTTP headers (e.g. X-HTML-Minification-Powered-By: WebMarkupMin )
|
All classes of markup minification managers and options have IncludedPages
and ExcludedPages
properties, that allow to include/exclude site pages from processing by corresponding markup minifier. These properties are of type IList<IUrlMatcher>
, and by default contains the empty lists, i.e. by default filtering is disabled.
There are 3 built-in implementations of IUrlMatcher
interface:
-
ExactUrlMatcher
. As a pattern used the URL (e.g.,new ExactUrlMatcher("/contact")
). -
RegexUrlMatcher
. As a pattern used a ECMAScript standard compliant regular expression (e.g.,new RegexUrlMatcher(@"^/minifiers/x(?:ht)?ml-minifier$")
). -
WildcardUrlMatcher
. Used a pattern, that supports Wildcard syntax (e.g.,new WildcardUrlMatcher("/minifiers/x*ml-minifier")
). This syntax supports 2 special characters:*
(match any number of any characters) and?
(match exactly one character).
By default all of the above implementations of IUrlMatcher
interface during matching is not case-sensitive. To change this behavior you need to pass to constructor of class as the second parameter value equals to true
(e.g., new ExactUrlMatcher("/Contact", true)
).
- Core
- External JS and CSS minifiers
- ASP.NET Extensions
- How to upgrade applications to version 2.X
- Additional reading and resources