Skip to content
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

[feature] Implement static minification and cache invalidation #216

Closed
10 tasks done
nemesifier opened this issue Nov 2, 2020 · 0 comments · Fixed by #222
Closed
10 tasks done

[feature] Implement static minification and cache invalidation #216

nemesifier opened this issue Nov 2, 2020 · 0 comments · Fixed by #222

Comments

@nemesifier
Copy link
Member

nemesifier commented Nov 2, 2020

We need implement static asset minification and make sure Javascript and CSS files get updated automatically without having to ask users to refresh their browser cache.

Unfortunately django-pipeline does not support simple minification without bundling files together, which requires changes to the code of OpenWISP modules which are overkill (given also HTTP2 multiplexing it's not extremely needed).

But its feature to Minify HTML is indeed useful, so we can use a mixture of different tools.

Packages to install: pip install django-pipeline django-compress-staticfiles

Configuration example:

# HTML minification with django pipeline
INSTALLED_APPS.append('pipeline')
MIDDLEWARE.append('pipeline.middleware.MinifyHTMLMiddleware')
PIPELINE = {
    'PIPELINE_ENABLED': True
}

# static files minification and invalidation with django-compress-staticfiles
STATICFILES_STORAGE = 'compress_staticfiles.storage.CompressStaticFilesStorage'
# GZIP compression is handled by nginx
BROTLI_STATIC_COMPRESSION = False
GZIP_STATIC_COMPRESSION = False

When using this configuration, a bug in openwisp modules is surfacing, we should not use the static() function in admin class media definitions, hence this has to be fixed/checked in the following modules:

@nemesifier nemesifier added this to To do in OpenWISP Priorities for next releases via automation Nov 2, 2020
@nemesifier nemesifier self-assigned this Nov 2, 2020
nemesifier added a commit to openwisp/openwisp-controller that referenced this issue Nov 2, 2020
nemesifier added a commit to openwisp/openwisp-controller that referenced this issue Nov 5, 2020
nemesifier added a commit to openwisp/django-x509 that referenced this issue Nov 13, 2020
nemesifier added a commit to openwisp/openwisp-controller that referenced this issue Nov 17, 2020
nemesifier added a commit to openwisp/openwisp-firmware-upgrader that referenced this issue Nov 17, 2020
@pandafy pandafy self-assigned this Nov 17, 2020
pandafy added a commit to pandafy/openwisp-network-topology that referenced this issue Nov 17, 2020
pandafy added a commit to pandafy/openwisp-radius that referenced this issue Nov 17, 2020
nemesifier pushed a commit to openwisp/openwisp-network-topology that referenced this issue Nov 18, 2020
nemesifier pushed a commit to openwisp/openwisp-radius that referenced this issue Nov 18, 2020
pandafy added a commit to pandafy/openwisp-network-topology that referenced this issue Nov 21, 2020
openwisp#96

jquery-ui.min.css contained url references to non existing images which
generated errors while using CompressStaticFilesStorage. Removing these
occurrences fixed the error.

Related to openwisp/ansible-openwisp2#216
Related to openwisp#96
pandafy added a commit to pandafy/openwisp-network-topology that referenced this issue Nov 21, 2020


jquery-ui.min.css contained url references to non existing images which
generated errors while using CompressStaticFilesStorage. Removing these
occurrences fixed the error.

Related to openwisp/ansible-openwisp2#216
Related to openwisp#96
pandafy added a commit to pandafy/openwisp-network-topology that referenced this issue Nov 21, 2020


jquery-ui.min.css contained url references to non existing images which
generated errors while using CompressStaticFilesStorage. Removing these
occurrences fixed the error.

Related to openwisp/ansible-openwisp2#216
Related to openwisp#96
nemesifier pushed a commit to openwisp/openwisp-network-topology that referenced this issue Nov 25, 2020
jquery-ui.min.css contained url references to non existing images which
generated errors while using CompressStaticFilesStorage. Removing these
occurrences fixed the error.

Related to openwisp/ansible-openwisp2#216
Related to #96
@nemesifier nemesifier moved this from Backlog to To do in OpenWISP Priorities for next releases Dec 1, 2020
@nemesifier nemesifier moved this from To do to In progress in OpenWISP Priorities for next releases Dec 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants