mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 21:43:21 +00:00
This is a big change affecting lots of areas: * Pipeline no longer deals with JS (though it still minifies CSS) * A new script, tools/minify-js (called from update-prod-static), minifies JavaScripts * A command-line argument --prev-deploy, if passed to minify-js or update-prod-static, is used to copy minified JS from a previous deploy (i.e., a previous git checkout), if the source files have not changed * update-deployment passes --prev-deploy * Scripts are now included with the minified_js template tag, rather than Pipeline's compressed_js Also, as a side benefit of this commit, our Handlebars templates will no longer be copied into prod-static/ and accessible in production. Unminification is probably broken, but, per Zev and Trac ticket #1377, it wasn't working perfectly before this change either. (Based on code review, this commit has been revised to: * Warn if git returns an error in minify-js * Add missing output redirects in update-prod-static * Use DEPLOY_ROOT instead of manually constructing that directory * Use old style formatting) (imported from commit e67722ea252756db8519d5c0bd6a421d59374185)
25 lines
919 B
Python
25 lines
919 B
Python
import re
|
|
from django.contrib.staticfiles.finders import AppDirectoriesFinder
|
|
|
|
class ExcludeUnminifiedMixin(object):
|
|
""" Excludes unminified copies of our JavaScript code, templates
|
|
and stylesheets, so that these sources don't end up getting served
|
|
in production. """
|
|
|
|
def list(self, ignore_patterns):
|
|
# We can't use ignore_patterns because the patterns are
|
|
# applied to just the file part, not the entire path
|
|
excluded = '^(js|styles|templates)/'
|
|
|
|
# source-map/ should also not be included.
|
|
# However, we work around that by moving it later,
|
|
# in tools/update-prod-static.
|
|
|
|
super_class = super(ExcludeUnminifiedMixin, self)
|
|
for path, storage in super_class.list(ignore_patterns):
|
|
if not re.search(excluded, path):
|
|
yield path, storage
|
|
|
|
class HumbugFinder(ExcludeUnminifiedMixin, AppDirectoriesFinder):
|
|
pass
|