Skip to content

Deploy gzipped CSS and javascript

T.J. Alumbaugh edited this page Mar 8, 2016 · 2 revisions

After doing a python manage.py collectstatic, the files will be uploaded to the bucket AWS_STORAGE_BUCKET. Additional optimization steps can be taken to decrease page loading time. We gzip CSS and javascript files to make TaxBrain load faster. Once the static files have been collected in the staticfiles directory, these instructions will copy them to a scratch directory, selectively gzip the CSS and js, then copy those up to the S3 bucket with the proper Content encodings. See the TaxBrain team if you need info on the environment variables:

mkdir /scratch/staticfiles
cp -r staticfiles/ /scratch/staticfiles
cd /scratch/staticfiles
find . -type f -name '*css' -exec gzip -9 {} \; -exec mv {}.gz {} \;
find . -type f -name '*js' -exec gzip -9 {} \; -exec mv {}.gz {} \;
cp ~/webapp/copy_static.py /scratch/staticfiles
python copy_static.py