This repository has been archived by the owner on Dec 6, 2019. It is now read-only.
Feature/minification bundling composite files #349
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ClientDependency (by Shannon Deminick) is a fairly solid framework for reducing all CSS and JS file requests into a single server request. Includes versioning, minification, bundling and caching.
I can appreciate it may not be everyone's prefered way of bundling, but it could be a good option to have.
This is an integration with some code changes and the original NuGet package into the assets Foundation module, that allows a developer to bundle all the JS/CSS assets via the following tags.
Usage in Layouts
- @CompositeAssetFileService.Current.RenderStyles()
- @CompositeAssetFileService.Current.RenderScript(ScriptLocation.Body)
Includes fall back to single assets requests files if the debug="false" is set on developer machines. Composite URLs are cached on the file system in App_Data, if using the default configuration.
Configuration options can be seen in the original documentation. https://github.com/Shazwazza/ClientDependency/wiki
To use this service you will need to rename the following and run the gulp build:
/// - "App_Config/ClientDependency.config.disabled". to App_Config/ClientDependency.config
/// - "\src\Foundation\Assets\code\Web.config.transform.ClientDependency.minification.example" to Web.config.transform
Once running (not in debug mode) you will see the following asset includes in the html source.
<script src="/DependencyHandler.axd/bdc200f5bb6df7e817066f4b98499322/12/js" type="text/javascript"></script>