From 92822cae384adfea5adab4c89edb37eefc76ac61 Mon Sep 17 00:00:00 2001 From: pdelboca Date: Fri, 1 Dec 2023 11:40:48 +0100 Subject: [PATCH] Remove django-compressor since our assets are minified by npm --- .env.base | 1 - foundation/settings.py | 17 ----------------- lib/precompilers.py | 26 -------------------------- requirements.in | 1 - requirements.txt | 9 --------- templates/general.html | 1 - 6 files changed, 55 deletions(-) delete mode 100644 lib/precompilers.py diff --git a/.env.base b/.env.base index e6879b4e..1330e8d3 100644 --- a/.env.base +++ b/.env.base @@ -3,7 +3,6 @@ CONTACT_EMAIL_SENDER= DJANGO_ADMINS=name1 , name2 DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1 -DJANGO_COMPRESS_OFFLINE=true DJANGO_CUSTOM_ASSETS_DOMAIN= DJANGO_DEBUG=true DJANGO_EMAIL_DEBUG=false diff --git a/foundation/settings.py b/foundation/settings.py index 61e79c10..73815e64 100644 --- a/foundation/settings.py +++ b/foundation/settings.py @@ -124,9 +124,6 @@ def _parse_email_list(varname): 'sendemail', 'captcha', - # Asset pipeline - 'compressor', - # CMS plugins 'djangocms_picture', 'djangocms_text_ckeditor', @@ -311,7 +308,6 @@ def _parse_email_list(varname): STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', - 'compressor.finders.CompressorFinder', ) # Where else to find static files @@ -438,19 +434,6 @@ def _parse_email_list(varname): # CSP_REPORT_URI = env.get('DJANGO_CSP_REPORT_URI') # CSP_REPORT_ONLY = True -COMPRESS_OFFLINE = env.get('DJANGO_COMPRESS_OFFLINE') == 'true' -COMPRESS_OFFLINE_CONTEXT = { - 'STATIC_URL': STATIC_URL, -} - -COMPRESS_PRECOMPILERS = ( - ('text/sass', 'lib.precompilers.SassFilter'), -) - -COMPRESS_FILTERS = { - 'css': ['compressor.filters.cssmin.CSSMinFilter'] -} - CMS_CACHE_DURATIONS = { 'content': 60, 'menus': 3600, diff --git a/lib/precompilers.py b/lib/precompilers.py deleted file mode 100644 index 23a01aae..00000000 --- a/lib/precompilers.py +++ /dev/null @@ -1,26 +0,0 @@ -from compressor.filters.base import CompilerFilter -from compressor.filters.css_default import CssAbsoluteFilter -from compressor.utils import staticfiles - - -class CustomCssAbsoluteFilter(CssAbsoluteFilter): - def find(self, basename): - # This is the same as the inherited implementation except for the - # removal of a check on settings.DEBUG. See - # - # https://stackoverflow.com/questions/15532464 - # - # for details. - if basename and staticfiles.finders: - return staticfiles.finders.find(basename) - - -# Work around the fact that django-compressor doesn't succeed in running the -# CssAbsoluteFilter on sass files due to broken path lookups. -class SassFilter(CompilerFilter): - def __init__(self, content, attrs, **kwargs): - super().__init__(content, command='sassc {infile} {outfile}', **kwargs) - - def input(self, **kwargs): - content = super().input(**kwargs) - return CustomCssAbsoluteFilter(content).input(**kwargs) diff --git a/requirements.in b/requirements.in index 087301fa..b2197b9e 100644 --- a/requirements.in +++ b/requirements.in @@ -8,7 +8,6 @@ cssmin==0.2.0 Django==4.2.3 django-cms==3.11.4 -django-compressor==4.4 django-countries==7.5.1 django-csp==3.7 django-environ==0.10.0 diff --git a/requirements.txt b/requirements.txt index c46e7ea8..b15268b6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,7 +25,6 @@ cssselect2==0.4.1 django==4.2.3 # via # -r requirements.in - # django-appconf # django-classy-tags # django-cms # django-csp @@ -44,8 +43,6 @@ django==4.2.3 # djangocms-admin-style # easy-thumbnails # jsonfield -django-appconf==1.0.4 - # via django-compressor django-classy-tags==3.0.1 # via # django-cms @@ -56,8 +53,6 @@ django-cms==3.11.4 # djangocms-attributes-field # djangocms-picture # djangocms-text-ckeditor -django-compressor==4.4 - # via -r requirements.in django-countries==7.5.1 # via -r requirements.in django-csp==3.7 @@ -186,8 +181,6 @@ pyasn1-modules==0.2.8 # via google-auth pyparsing==3.0.9 # via packaging -rcssmin==1.1.1 - # via django-compressor redis==4.5.3 # via django-redis reportlab==3.6.5 @@ -199,8 +192,6 @@ requests==2.31.0 # -r requirements.in # google-api-core # google-cloud-storage -rjsmin==1.2.1 - # via django-compressor rsa==4.7.2 # via google-auth sgmllib3k==1.0.0 diff --git a/templates/general.html b/templates/general.html index 22cc8600..8a627413 100644 --- a/templates/general.html +++ b/templates/general.html @@ -1,6 +1,5 @@ {% extends "base.html" %} -{% load compress %} {% load cms_tags %} {% load menu_tags %} {% load static %}