Score:0

PageSpeed combine_javascript How to avoid all scripts (e.g. those with data-* attributes) being combined

eg flag

I have something like the following:

<script src="js/jquery.js">
<script src="js/bootstrap.js">
<script src="js/featured-news.js" data-container-id="news1">
<script src="js/featured-news.js" data-container-id="news2">

I'd like the jquery and bootstrap scripts to be combine into something like:

<script src="js/jquery.js+bootstrap.js.pagespeed.jc.FTvtsO6TBe.js"></script>

But I'd like the script tags with data-* attributes to be left alone. So the end result might look like:

<script src="js/jquery.js+bootstrap.js.pagespeed.jc.FTvtsO7TBe.js"></script>
<script src="js/featured-news.js" data-container-id="news1">
<script src="js/featured-news.js" data-container-id="news2">

I'd still like the contents of these files to be minified though. How would I configure pagespeed to do this? Will combine_javascript module acknowledge that both these script tags have data-* attributes and merging them might cause issues?

John R avatar
in flag
can you explain your ultimate end goal? in other words : do you want your pages to load faster in browsers? or you're looking for something else.
John R avatar
in flag
if you need a smaller version of jquery, I made one : https://github.com/jintor/stubquery.js
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.