How to make JS and CSS bundles Last updated: 16. Apr 2023
Get higher ranked with fewer JS and CSS files. In other words, this means that you should always bundle all JS and CSS files to one JS-file and one CSS-file.
Always bundle minified files
If your files are not minified do it online:
Google will punish you if they are not minified!
Make a JS bundle (Example)
Suggested name for your file: bundle.js.hash
#{
setmime("text/javascript");
write(include("/#/root/assets/js/theme.core.min.js"));
write(include("/#/root/assets/js/theme.min.js"));
write(include("/#/root/assets/js/jquery.submitform.js"));
write(include("/#/root/assets/js/jquery.editpage.js"));
write(include("/#/root/assets/js/cookiealert.js"));
}#
How to use it:
<script src="/assets/js/bundle.js"></script>
Note that you do not need and should not write ".hash" - Docly will find the file without it.
Make a CSS bundle (Example)
Suggested name for your file: bundle.css.hash
#{
setmime("text/css");
write(include("/#/root/assets/css/theme.min.css"));
write(include("/#/root/assets/css/cookiealert.min.css"));
}#
How to use it:
<link href="/assets/css/bundle.css" rel="stylesheet"/>
Note that you do not need and should not write ".hash" - Docly will find the file without it.