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

Provide separate filters rewrite_javascript_external and rewrite_javascript_inline #853

Closed
GoogleCodeExporter opened this Issue Apr 6, 2015 · 10 comments

Comments

Projects
None yet
1 participant
@GoogleCodeExporter
Copy link

GoogleCodeExporter commented Apr 6, 2015

From: datahitllc

Is there a way to remove minifying on the javascript in pages which is not 
referred to by an external tag (src=).

I only want these files to be minified, not the small bits inside 
<script></script>

Original issue reported on code.google.com by jmara...@google.com on 19 Dec 2013 at 3:28

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

Can you explain why you only want external scripts minified? Are we breaking 
your inline scripts?

Original comment by sligocki@google.com on 19 Dec 2013 at 6:23

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

I can hazard a guess: it makes debugging the inline JS harder.  There's a 
workaround:

Use:
   ?ModPagespeedFilters=-rewrite_javascript
on the URL line.

Alex -- is this sufficient?

Original comment by jmara...@google.com on 19 Dec 2013 at 7:24

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

Hey folks, thanks for the replies.

I'd like to be able to choose what I want to minify (inline <script></script> 
code or external src=... code) because I want to make 100% sure that that 
inline code isn't ever cached and served to a wrong user.  I have some of that 
inline code generated on the fly with per-user data.

Another thing while I got you guys listening :)  I run a forum site.  People 
post a ton of images, most of which are hotlinked from other sites.  I don't 
want to cache those with MPS (quickly becomes a huge amount of data on the disk 
not to mention it slows my servers down to a crawl with apache2 taking a lot of 
CPU).  However, I'd like to cache the images that are on my cdn.domain.com

I disabled image caching by using ModPagespeedDisallow *.jpg (and other 
extensions), however this obviously disabled caching for my cdn domain as well. 
 Is there any solution?  I run MPS  1.6.29.7-r3566.

I'd also like to take this opportunity to commend you folks on your awesome 
product which I'm sure has a great future.


Original comment by datahit...@gmail.com on 20 Dec 2013 at 1:41

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

As for ?ModPagespeedFilters=-rewrite_javascript - won't this disable external 
JS file rewriting as well?

Original comment by datahit...@gmail.com on 20 Dec 2013 at 1:42

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

The inline scripts are not cached when they are minified; it happens only on 
the fly.  It's OK to have user private data in there.

RE controlling URLs: Please read these two pages to understand exactly what the 
controls do:
   https://developers.google.com/speed/pagespeed/module/restricting_urls
   https://developers.google.com/speed/pagespeed/module/domains
I am not sure why you would be getting forum hotlinks rewritten and cached by 
MPS.  MPS will not do that unless you have done something like 
"ModPagespeedDomain *", which only makes sense in a forward proxy.  Did you 
look at your cache directory and find externally hosted files referenced there?

RE commendation:   thanks that's much appreciated!!!

RE "-rewrite_javascript": yes that would disable external rewriting as well.  
That was offered as a debug hack assuming that was the rationale for your 
original request.  You can ignore that comment :)

Original comment by jmara...@google.com on 20 Dec 2013 at 1:58

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

Jeezus !! I had ModPagespeedDomain * indeed.
Solution was there.  I now just put ModPagespeedDomain cdn.domain.com and all 
works as I wanted it to.

Thanks.

Original comment by datahit...@gmail.com on 20 Dec 2013 at 2:03

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

"I'd like to be able to choose what I want to minify (inline <script></script> 
code or external src=... code) because I want to make 100% sure that that 
inline code isn't ever cached and served to a wrong user."

Minification of inline javascript is done entirely on the fly and can't be 
cached and served to other users.  Are there other reasons why being able to 
turn off minifying inline resources would be useful?  Otherwise I'm inclined to 
close this feature request.

Original comment by jefftk@google.com on 2 Jan 2014 at 3:14

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

IMO it would be a nice addition that wouldn't hurt, that's all.

Original comment by datahit...@gmail.com on 13 Jan 2014 at 9:45

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

Original comment by jmara...@google.com on 19 Aug 2014 at 3:19

  • Changed state: Started
@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

Summary was: Disable minifying inline JS

As of https://code.google.com/p/modpagespeed/source/detail?r=4176 we have 
separate options rewrite_javascript_external and rewrite_javascript_inline.  
Both of them are enabled by turning on rewrite_javascript.

Original comment by jmara...@google.com on 21 Aug 2014 at 4:49

  • Changed title: Provide separate filters rewrite_javascript_external and rewrite_javascript_inline
  • Changed state: Fixed
  • Added labels: Milestone-v32, release-note
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment