On this page
Aggregate CSS and JS files in Drupal core
Last updated on
17 March 2025
You can make Drupal perform better by aggregating CSS and JavaScript files. This will save bandwidth and server requests, resulting in faster load times for the users.
Enable caching, and CSS and JavaScript aggregation
- Go to Configuration > Development > Performance and set "Browser and proxy cache maximum age" to a time span which works well.
- Under Bandwidth Optimization enable "Aggregate and compress CSS files", and "Aggregate JavaScript files".
Note that enabling "Aggregate JavaScript files" may cause redeclaration in rare cases. The workaround is to disable aggregation for the problematic JavaScript library:
mymodule.somelibrary:
js:
js/foo.js: { preprocess: false }
Help improve this page
Page status: No known problems
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion