I was recently looking over the source code of a page on a site I’m building and noticed the following was in the page code…
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/aos/2.3.4/aos.css"> <script src="https://cdnjs.cloudflare.com/ajax/libs/aos/2.3.4/aos.js"></script>
The problem is, I had nothing animated on the page. I was pulling my hair out trying to figure out why these were being loaded even though none of the components on the page had animations.
After some experimenting, I discovered that it seems if you use an animation on any page of your site, the animation CSS and JS gets added to every page of the site. Of course this is undesirable since there’s no reason to load assets on a page that aren’t needed. I can’t find any way to prevent this other than manually editing the code after export (maybe it can be done with an export script, but I’m not familiar with writing scripts.)
Temporarily, I can duplicate the site, delete all the pages with animations, and then export the pages I need separately, but this is a cludgy work-around.