Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Canonical Google-Hosted JavaScript Libraries #532

Closed
nikolay opened this issue Sep 28, 2013 · 4 comments
Closed

Canonical Google-Hosted JavaScript Libraries #532

nikolay opened this issue Sep 28, 2013 · 4 comments

Comments

@nikolay
Copy link
Contributor

nikolay commented Sep 28, 2013

We need ngx_pagespeed to be at par with mod_pagespeed. A script that grabs https://code.google.com/p/modpagespeed/source/browse/trunk/src/net/instaweb/genfiles/conf/pagespeed_libraries.conf and converts it into an Nginx-specific include should be trivial. If you provide me some guidance on what language to use (Bash, Python, etc.) and how you want it to be called, I can do a PR.

https://developers.google.com/speed/pagespeed/module/filter-canonicalize-js

@jeffkaufman
Copy link
Contributor

You're right, we should have this. A first crack:

curl https://modpagespeed.googlecode.com/svn/trunk/src/net/instaweb/genfiles/conf/pagespeed_libraries.conf \
     | grep ModPagespeedLibrary \
     | while read library size hash url ; do
  echo "  pagespeed Library $size $hash \"$url\";"
done

Running it:

  pagespeed Library 77558 kcPHCgcherC-W9O8fz361 "//ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js";
  pagespeed Library 142702 vQUO_A9tgEsoOYUdTrxZE "//ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js";
  pagespeed Library 78028 lw42Fc83V2eHxxE6RIQXi "//ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js";

The output of this should probably be a file we include in the release.

@nikolay
Copy link
Contributor Author

nikolay commented Sep 28, 2013

Great!

@vidluther
Copy link

At first glance, this script doesn't seem to do the trick. I ran the script above and output the contents to hosted_js.conf.

I included the file and enabled the directive.. but http://engineering.zippykid.com/ps.html did not seem to take the modifications.. the original html is

 <html>
  <head>
    <script src="jquery_1_10.js">
    </script>
    <script src="a.js">
    </script>
    <script src="b.js">
    </script>
  </head>
  <body>
  ...
  </body>
</html>

But, a manual wget of and modification of the file https://modpagespeed.googlecode.com/svn/trunk/src/net/instaweb/genfiles/conf/pagespeed_libraries.conf seems to work. (currently the site mentioned above, is using the modified version)

@vidluther
Copy link

#!/bin/bash

curl https://modpagespeed.googlecode.com/svn/trunk/src/net/instaweb/genfiles/conf/pagespeed_libraries.conf \
     | grep ModPagespeedLibrary \
     | while read library size hash url ; do
  echo "  pagespeed Library $size $hash $url;"
done

FYI, I looked into it a bit more, and here's the change (remove the "..)..

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants