-
Notifications
You must be signed in to change notification settings - Fork 10
Bundling css javascript Gzip
In MVC prior to .net core, bundling of CSS and Javascript was largely handled by the server through it's Bundling classes. in .net core, there is no server-side bundling, everything is done through other css/javascript bundling systems.
The Baseline uses Bundler & Minifier to bundle its various CSS and Javascript.
The bundleconfig.js file contains the baseline's default bundles. It has the following bundles:
- HeaderStyles.min.css: Styles for the site
- HeaderJS.min.j: Javascript files that are loaded in the head, should keep these to a minimum, but if you use jQuery usually that is declared in the head so any $ javascript commands will operate.
- FooterJS.min.js: The majority of the javascript files that are loaded in the footer.
- jqueryval.min.js: jQuery Validators that operate alongside MVC's data annotation attributes and their html rendering
- jquery-unobtrusive-ajax.min.js: jQuery plugin for ajax handling using data attributes.
You can modify the contents of these tools. There are also HeaderCustom.js
, Custom.js
, Custom.css
files that are part of these bundles that you can add your custom content to easily.
In the _layout you'll notice various <environment>
tag helpers, either including or excluding Development
. The idea is that if you are developing, you should load all the CSS / Javascript unminified so you can more easily debug / make adjustments. Be sure to add your css files to thes Development areas along with the bundles.
You should install Web Essentials extension on your visual studio if you do not already have it. This contains the tools to detect css/javascript changes and recomplie your bundles.
The baseline also has systems put in place to allow Gzip handling of css / javascript. If your file ends with js.gz or css.gz, it will properly set the headers, this results in a MUCH faster download of css/javascript files.
- Solution architecture
- Feature Folders
- Page Template View Component
- Interface Model Implementation Map
- Cache Dependency Building and Async
- Post Redirect Get
- Front End Asset (CSS/JS Parsing
- Navigation
- Page Builder Header/Footer
- SEO Meta Data
- Navigation Redirection
- Page Types
- Partial Widget Page / ShareableContent
- Widgets
- Account Management
- External Authentication/Two Factor Authentication
- Ecommerce Ready
- Error Pages
- Sitemap
- Robots.txt
- Form Bootstrapification
- Bundling css/javascript + Gzip
- Bootstrap and Containers