https://www.drupal.org/project/advagg
Install and Enable the Advanced CSS/JS Aggregation Module
- Install the Advanced CSS/JS Aggregation module on your server. (See Chapter 1 for more instructions on installing modules.)
- Go to the Extend page: Click Manage > Extend (Coffee: “extend”)
- Select the checkboxes next to:
- AdvAgg Bundler
- AdvAgg CDN
- AdvAgg CSS/JS Validator
- AdvAgg External Minification
- AdvAgg Minify CSS
- AdvAgg Minify JavaScript
- AdvAgg Modifier
- Advanced CSS/JS Aggregation
- Click the Install button at the bottom of the page.
Configure the Drupal Advanced CSS/JS Aggregation module
- Go to the Advanced CSS/JS Aggregation module admin page by clicking Manage > Configuration > Development > Performance > AdvAgg (Coffee: “advagg”) or visit http://yourDrupal8site.dev//config/development/performance/a dvagg in your browser.
- To start out, don’t change anything! The default settings for this module are pretty spot-on for error-free performance.
- Test your site. Make sure all of your pages are loading properly.
- You can squeeze faster performance out of your website by testing the High and Aggressive settings. Just be aware that they may cause some pages to display incorrectly. As with all things, check your results thoroughly. JavaScript Minification “Minification (also minimization or minimization), in computer programming languages and especially JavaScript, is the process of removing all unnecessary characters from source code without changing its functionality. These unnecessary characters usually include white space characters, new line characters, comments, and sometimes block delimiters, which are used to add readability to the code but are not required for it to execute.” —Wikipedia By default, Advanced CSS/JS Aggregation does not minify JavaScript files. You can turn on Minification like this:
- Go to the Advanced CSS/JS Aggregation module admin page by clicking Manage > Configuration > Development > Performance > AdvAgg > JavaScript Minification (Coffee: “javascript”)
- There are 3 built-in options. Select JSqueeze.
- Click the Save configuration button at the bottom of the page. Test! Make sure your site is working properly. Be sure to check all of your contact forms. Take a post-installation benchmark with Google’s PageSpeed Insights tool (https://developers.google.com/speed/pagespeed/insights/) and WebPageTest.org (http://www.webpagetest.org/). These tools will help you determine if more aggressive caching will improve your site’s speed.