New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canonical Google-Hosted JavaScript Libraries #532

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

Comments

Projects
None yet
3 participants
@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

This comment has been minimized.

Copy link
Contributor

jeffkaufman commented Sep 28, 2013

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

This comment has been minimized.

Copy link
Contributor

nikolay commented Sep 28, 2013

Great!

@vidluther

This comment has been minimized.

Copy link

vidluther commented Oct 1, 2013

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

This comment has been minimized.

Copy link

vidluther commented Oct 1, 2013

#!/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 join this conversation on GitHub. Already have an account? Sign in to comment