Question

Just installed a recent version of mod-pagespeed on my django instance and tried to minify CSS/JS with the following pagespeed.conf but in vain, even though remove_comments and collapse_whitespace seemed to work out.

ModPagespeedEnableFilters rewrite_javascript,rewrite_css,flatten_css_imports
ModPagespeedEnableFilters collapse_whitespace,elide_attributes
ModPagespeedEnableFilters combine_javascript,remove_comments

In django templates, CSS/JS url was pointed by {{ STATIC_URL }}media/main.js, etc and the matching folder was set up as an alias at the apache setup, but JS/CSS (and its link) are all unchanged at all.

I suspect mod-pagespeed didn't pick up the js/css due to the intervention from template engine..?

Was it helpful?

Solution

I just finally found out the option that will make difference.

# Explicitly tell mod_pagespeed to load some resources from disk.
# This will speed up load time and update frequency.
#
# This should only be used for static resources which do not need
# specific headers set or other processing by Apache.
#
# Both URL and filesystem path should specify directories and
# filesystem path must be absolute (for now).
#
ModPagespeedLoadFromFile "http://example.com/static/" "/var/www/static/"

Commenting out ModPagespeedLoadFromFile and locate static folders for your js/css

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top