-
-
Notifications
You must be signed in to change notification settings - Fork 65
Configuration
Shannon Deminick edited this page Nov 17, 2016
·
7 revisions
CDF has many configuration option if you need to custom how it works. By default our Nuget package ships with the minimal configuration which assigns the default behavior for all elements.
At a minimum you need to register:
<system.web>
<httpHandlers>
<add verb="*" path="DependencyHandler.axd" type="ClientDependency.Core.CompositeFiles.CompositeDependencyHandler, ClientDependency.Core "/>
</httpHandlers>
</system.web>
<system.webServer>
<handlers>
<remove name="DependencyHandler"/>
<add name="DependencyHandler" preCondition="integratedMode" verb="*" path="DependencyHandler.axd" type="ClientDependency.Core.CompositeFiles.CompositeDependencyHandler, ClientDependency.Core "/>
</handlers>
</system.webServer>
<system.web>
<httpModules>
<add name="ClientDependencyModule" type="ClientDependency.Core.Module.ClientDependencyModule, ClientDependency.Core"/>
</httpModules>
</system.web>
<system.webServer>
<modules>
<remove name="ClientDependencyModule" />
<add name="ClientDependencyModule" type="ClientDependency.Core.Module.ClientDependencyModule, ClientDependency.Core"/>
</modules>
</system.webServer>
<configSections>
<section name="clientDependency" type="ClientDependency.Core.Config.ClientDependencySection, ClientDependency.Core" requirePermission="false"/>
</configSections>
<clientDependency version="1" />
The below xml shows all of the configuration options that can be set. None of the options are required, if any are ommitted then the defaults will be used.
<clientDependency version="76" fileDependencyExtensions=".js,.css">
<!--
This section is used for Web Forms only, the enableCompositeFiles="true" is optional and by default is set to true.
The PlaceHolderProvider is set to default, the javascriptPlaceHolderId, cssPlaceHolderId attributes are optional and default to what is listed below. If using
this provider, then you must specify both PlaceHolder controls on your page in order to render the JS/CSS.
-->
<fileRegistration defaultProvider="PlaceHolderProvider">
<providers>
<add name="PageHeaderProvider" type="ClientDependency.Core.FileRegistration.Providers.PageHeaderProvider, ClientDependency.Core" enableCompositeFiles="true" disableCompositeBundling="false" enableDebugVersionQueryString="true" />
<add name="LazyLoadProvider" type="ClientDependency.Core.FileRegistration.Providers.LazyLoadProvider, ClientDependency.Core" enableCompositeFiles="true" disableCompositeBundling="false" enableDebugVersionQueryString="true"/>
<add name="LoaderControlProvider" type="ClientDependency.Core.FileRegistration.Providers.LoaderControlProvider, ClientDependency.Core" enableCompositeFiles="true" disableCompositeBundling="false" enableDebugVersionQueryString="true"/>
<add name="PlaceHolderProvider" type="ClientDependency.Core.FileRegistration.Providers.PlaceHolderProvider, ClientDependency.Core" enableCompositeFiles="true" javascriptPlaceHolderId="JavaScriptPlaceHolder" cssPlaceHolderId="CssPlaceHolder" disableCompositeBundling="false" enableDebugVersionQueryString="true"/>
</providers>
</fileRegistration>
<!-- This section is used for MVC only -->
<mvc defaultRenderer="StandardRenderer">
<renderers>
<add name="StandardRenderer" type="ClientDependency.Core.FileRegistration.Providers.StandardRenderer, ClientDependency.Core" enableCompositeFiles="true" disableCompositeBundling="false" enableDebugVersionQueryString="true"/>
<add name="LazyLoadRenderer" type="ClientDependency.Core.FileRegistration.Providers.LazyLoadRenderer, ClientDependency.Core" enableCompositeFiles="true" disableCompositeBundling="false" enableDebugVersionQueryString="true"/>
</renderers>
</mvc>
<!--
The composite file section configures the compression/combination/minification of files.
You can enable/disable minification and/or bundling of either JS/CSS files and you can enable/disable the
persistence of composite files. By default, minification and persistence is enabled. Persisting files
means that the system is going to save the output of the compressed/combined/minified files
to disk so that on any subsequent request (when output cache expires) that these files don't have
to be recreated again and will be based on the persisted file on disk. This saves on processing time.
-->
<compositeFiles defaultFileProcessingProvider="CompositeFileProcessor" defaultFileMapProvider="XmlFileMap" compositeFileHandlerPath="~/DependencyHandler.axd">
<!--
File processing providers perform the file combination, compression and storage.
Generally there would be no reason to replace.
NOTE: The pathUrlFormat is much nicer as {dependencyId}.{version}.{type} which is the default,
however, it is specified below with '/' as the delimiter to demonstrate using it with Cassini
since Cassini does not support '.' chars in the path.
-->
<fileProcessingProviders>
<add name="CompositeFileProcessor"
type="ClientDependency.Core.CompositeFiles.Providers.CompositeFileProcessingProvider, ClientDependency.Core"
enableCssMinify="false"
enableJsMinify="false"
persistFiles="true"
compositeFilePath="~/App_Data/ClientDependency"
bundleDomains="localhost:54153"
urlType="MappedId"
pathUrlFormat="{dependencyId}/{version}/{type}"/>
</fileProcessingProviders>
<!--
A file map provider stores references to dependency files by an id to be used in the handler URL when using the MappedId Url type
-->
<fileMapProviders>
<add name="XmlFileMap"
type="ClientDependency.Core.CompositeFiles.Providers.XmlFileMapper, ClientDependency.Core"
mapPath="~/App_Data/ClientDependency"/>
</fileMapProviders>
<!--
Defines the mime types to compress when requested by the client.
Path is a regex selector, or a * can be used as in place of 'any'.
Generally mime types are only set by client browsers in the request for things
such as JSON or XML ajax requests.
-->
<mimeTypeCompression>
<add type="application/json" path="^.*?/Services/.*"/>
</mimeTypeCompression>
<!--
Defines the paths to match on to enable rogue file compression.
Path is a regex selector, or a * can be used as in place of 'any'.
jsExt and cssExt are comma seperated list of extensions to match to have the dependencies
replaced with the composite file handler. You can even include ASP.Net web service JS proxies.
-->
<rogueFileCompression>
<add path="*" compressJs="true" compressCss="true" jsExt=".js,asmx/js" cssExt=".css">
<!--<exclusions>
<add path="^.*test.aspx.*"/>
</exclusions>-->
</add>
</rogueFileCompression>
</compositeFiles>
</clientDependency>