diff --git a/caps/static/caps/scss/main.scss b/caps/static/caps/scss/main.scss index a1a7a56e8..c7e45e612 100644 --- a/caps/static/caps/scss/main.scss +++ b/caps/static/caps/scss/main.scss @@ -1,61 +1,44 @@ @charset "utf-8"; -// A NOTE ABOUT FILE PATHS -// -// django.contrib.staticfiles copies this file into the `STATIC_ROOT` -// (along with any other files/directories defined in `STATICFILES_DIRS`) -// and then django-pipeline compiles the Sass files from there. -// -// So imports in this file are relative to `/caps/sass/main.scss`, -// not `/caps/static/caps/caps/main.scss`. -// -// That’s why `@import "../../bootstrap/" works – because at the -// point the Sass files are compiled, django.contrib.staticfiles has -// already copied the bootstrap sass files into `/bootstrap/`. -// -// Note that this doesn't work on a dev thing with standard django-pipeline -// due to this issue: https://github.com/jazzband/django-pipeline/issues/749 -// so we are using a fork with the patch from the above issue - @import "variables"; -@import "../../bootstrap/functions"; -@import "../../bootstrap/variables"; -@import "../../bootstrap/mixins"; -@import "../../bootstrap/root"; -@import "../../bootstrap/reboot"; -@import "../../bootstrap/type"; -@import "../../bootstrap/images"; -@import "../../bootstrap/code"; -@import "../../bootstrap/grid"; -@import "../../bootstrap/tables"; -@import "../../bootstrap/forms"; -@import "../../bootstrap/buttons"; -@import "../../bootstrap/transitions"; -// @import "../../bootstrap/dropdown"; -// @import "../../bootstrap/button-group"; -// @import "../../bootstrap/input-group"; -// @import "../../bootstrap/custom-forms"; -@import "../../bootstrap/nav"; -@import "../../bootstrap/navbar"; -@import "../../bootstrap/card"; -// @import "../../bootstrap/breadcrumb"; -// @import "../../bootstrap/pagination"; -@import "../../bootstrap/badge"; -// @import "../../bootstrap/jumbotron"; -// @import "../../bootstrap/alert"; -@import "../../bootstrap/progress"; -// @import "../../bootstrap/media"; -// @import "../../bootstrap/list-group"; -// @import "../../bootstrap/close"; -// @import "../../bootstrap/toasts"; -@import "../../bootstrap/modal"; -@import "../../bootstrap/tooltip"; -// @import "../../bootstrap/popover"; -// @import "../../bootstrap/carousel"; -@import "../../bootstrap/spinners"; -@import "../../bootstrap/utilities"; -@import "../../bootstrap/print"; +@import "../../vendor/bootstrap/scss/functions"; +@import "../../vendor/bootstrap/scss/variables"; +@import "../../vendor/bootstrap/scss/mixins"; +@import "../../vendor/bootstrap/scss/root"; +@import "../../vendor/bootstrap/scss/reboot"; +@import "../../vendor/bootstrap/scss/type"; +@import "../../vendor/bootstrap/scss/images"; +@import "../../vendor/bootstrap/scss/code"; +@import "../../vendor/bootstrap/scss/grid"; +@import "../../vendor/bootstrap/scss/tables"; +@import "../../vendor/bootstrap/scss/forms"; +@import "../../vendor/bootstrap/scss/buttons"; +@import "../../vendor/bootstrap/scss/transitions"; +// @import "../../vendor/bootstrap/scss/dropdown"; +// @import "../../vendor/bootstrap/scss/button-group"; +// @import "../../vendor/bootstrap/scss/input-group"; +// @import "../../vendor/bootstrap/scss/custom-forms"; +@import "../../vendor/bootstrap/scss/nav"; +@import "../../vendor/bootstrap/scss/navbar"; +@import "../../vendor/bootstrap/scss/card"; +// @import "../../vendor/bootstrap/scss/breadcrumb"; +// @import "../../vendor/bootstrap/scss/pagination"; +@import "../../vendor/bootstrap/scss/badge"; +// @import "../../vendor/bootstrap/scss/jumbotron"; +// @import "../../vendor/bootstrap/scss/alert"; +@import "../../vendor/bootstrap/scss/progress"; +// @import "../../vendor/bootstrap/scss/media"; +// @import "../../vendor/bootstrap/scss/list-group"; +// @import "../../vendor/bootstrap/scss/close"; +// @import "../../vendor/bootstrap/scss/toasts"; +@import "../../vendor/bootstrap/scss/modal"; +@import "../../vendor/bootstrap/scss/tooltip"; +// @import "../../vendor/bootstrap/scss/popover"; +// @import "../../vendor/bootstrap/scss/carousel"; +@import "../../vendor/bootstrap/scss/spinners"; +@import "../../vendor/bootstrap/scss/utilities"; +@import "../../vendor/bootstrap/scss/print"; @import "awesomplete"; @import "equilateral-triangle"; diff --git a/caps/templates/caps/base.html b/caps/templates/caps/base.html index 22388e794..1f8a33c1e 100644 --- a/caps/templates/caps/base.html +++ b/caps/templates/caps/base.html @@ -1,5 +1,5 @@ {% load static %} -{% load pipeline %} +{% load compress %} {% load hosts %} @@ -24,7 +24,9 @@ - {% stylesheet 'caps' %} + {% compress css %} + + {% endcompress %} {% block extrastylesheets %}{% endblock %} diff --git a/conf/config.py.docker b/conf/config.py.docker index 6373cb0a7..f78d9cd85 100755 --- a/conf/config.py.docker +++ b/conf/config.py.docker @@ -3,7 +3,7 @@ from distutils.util import strtobool SECRET_KEY = os.environ.get("SECRET_KEY", "xx") SASSC_LOCATION = os.environ.get("SASSC_LOCATION", "pysassc") -DEBUG = int(os.environ.get("DEBUG", 1)) +DEBUG = bool(os.environ.get("DEBUG", True)) ALLOWED_HOSTS = ["*"] REPOSITORY_DB_HOST = os.environ.get("REPOSITORY_DB_HOST", "postgres") diff --git a/poetry.lock b/poetry.lock index f5852d0a6..cade3be71 100644 --- a/poetry.lock +++ b/poetry.lock @@ -404,33 +404,6 @@ category = "main" optional = false python-versions = "*" -[[package]] -name = "django-pipeline" -version = "2.0.6.post2+gc67514a" -description = "Pipeline is an asset packaging library for Django." -category = "main" -optional = false -python-versions = "*" -develop = false - -[package.source] -type = "git" -url = "https://github.com/mysociety/django-pipeline" -reference = "HEAD" -resolved_reference = "c67514ae828f79454320a37b0aeb154c7359e19c" - -[[package]] -name = "django-pipeline-csscompressor" -version = "0.1" -description = "A django-pipeline compressor to compress css files using csscompressor" -category = "main" -optional = false -python-versions = "*" - -[package.dependencies] -csscompressor = ">=0.9.4" -django-pipeline = ">=1.6.8" - [[package]] name = "django-simple-history" version = "3.5.0" @@ -1266,7 +1239,7 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "1.1" python-versions = "^3.9" -content-hash = "c502ab2aab284c49d42ec2ad60db2edf80bfe32485acfbb3e538ad9bbbf22524" +content-hash = "ae870551de759808b34e965fa082570988ef4661c3fc0083b2d5272444ebbfd8" [metadata.files] altair = [ @@ -1586,11 +1559,6 @@ django-markitup = [ {file = "django-markitup-4.1.0.tar.gz", hash = "sha256:029603337e8614142f50383c826ba5bd2085bba0b0daee3c4c2d6245519415ed"}, {file = "django_markitup-4.1.0-py3-none-any.whl", hash = "sha256:16ea75600bedb3a1f01dca0c83473b8ee25ae905543ecef2fd755eeaac0e496a"}, ] -django-pipeline = [] -django-pipeline-csscompressor = [ - {file = "django-pipeline-csscompressor-0.1.tar.gz", hash = "sha256:dd5cfd11fd1439ffe8bc42e0d5150881a485613cfc43c7895dbce957bb0adb9a"}, - {file = "django_pipeline_csscompressor-0.1-py2.py3-none-any.whl", hash = "sha256:f1730cd89042ffc0801698e071501b23798cc4885f9ff77f4fb5a59afd5d9b99"}, -] django-simple-history = [ {file = "django-simple-history-3.5.0.tar.gz", hash = "sha256:eef2943d7c846270f11c8136f38a3ba00de2bebd7b1b89037de5d9b148ed677a"}, {file = "django_simple_history-3.5.0-py3-none-any.whl", hash = "sha256:0030b3bb5ed219d6453320213e75cfa00dab7a381946124df9411729101c8874"}, diff --git a/proj/settings.py b/proj/settings.py index ee6bf5177..8143c9395 100755 --- a/proj/settings.py +++ b/proj/settings.py @@ -39,10 +39,12 @@ if DEBUG: IS_LIVE = False - STATICFILES_STORAGE = "pipeline.storage.NonPackagingPipelineStorage" else: IS_LIVE = True - STATICFILES_STORAGE = "pipeline.storage.PipelineManifestStorage" + # only want to do this for live really + STATICFILES_STORAGE = ( + "django.contrib.staticfiles.storage.ManifestStaticFilesStorage" + ) LANGUAGE_CODE = "en-uk" @@ -72,6 +74,9 @@ ] STATICFILES_DIRS = ( + ("caps", os.path.join(BASE_DIR, "caps", "static")), + ("scoring", os.path.join(BASE_DIR, "scoring", "static")), + ("scoring2022", os.path.join(BASE_DIR, "scoring2022", "static")), ( "bootstrap", os.path.join(BASE_DIR, "vendor", "bootstrap", "scss"), @@ -113,33 +118,11 @@ STATICFILES_FINDERS = ( "django.contrib.staticfiles.finders.FileSystemFinder", "django.contrib.staticfiles.finders.AppDirectoriesFinder", - "pipeline.finders.PipelineFinder", - "django.contrib.staticfiles.finders.AppDirectoriesFinder", + "compressor.finders.CompressorFinder", ) -PIPELINE = { - "STYLESHEETS": { - "caps": { - "source_filenames": ("caps/scss/main.scss",), - "output_filename": "css/caps.css", - }, - "scoring": { - "source_filenames": ("scoring/scss/main.scss",), - "output_filename": "css/scoring.css", - }, - "scoring2022": { - "source_filenames": ("scoring2022/scss/main.scss",), - "output_filename": "css/scoring2022.css", - }, - }, - "CSS_COMPRESSOR": "django_pipeline_csscompressor.CssCompressor", - "DISABLE_WRAPPER": True, - "COMPILERS": ("pipeline.compilers.sass.SASSCompiler",), - "SHOW_ERRORS_INLINE": False, - # Use the libsass commandline tool (that's bundled with libsass) as our - # sass compiler, so there's no need to install anything else. - "SASS_BINARY": SASSC_LOCATION, -} +COMPRESS_PRECOMPILERS = (("text/x-scss", "django_libsass.SassCompiler"),) +COMPRESS_CSS_HASHING_METHOD = "content" DATA_DIR = "data" PLANS_DIR = os.path.join(DATA_DIR, "plans") @@ -206,7 +189,7 @@ "django_filters", "django_hosts", "haystack", - "pipeline", + "compressor", "bootstrap4", "django_bootstrap5", "rest_framework", diff --git a/pyproject.toml b/pyproject.toml index 5ea3b873a..1a91fdfd3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,8 +64,6 @@ altair = "^5.1.1" mysoc-dataset = "^0.2.1" tqdm = "^4.65.0" feedparser = "^6.0.11" -django-pipeline = {git = "https://github.com/mysociety/django-pipeline"} -django-pipeline-csscompressor = "^0.1" django-hosts = "^6.0" mailchimp-marketing = {git = "https://github.com/mailchimp/mailchimp-marketing-python.git"} django-libsass = "^0.9" diff --git a/scoring/static/scoring/scss/main.scss b/scoring/static/scoring/scss/main.scss index ddf8ed84f..2a1e1a136 100644 --- a/scoring/static/scoring/scss/main.scss +++ b/scoring/static/scoring/scss/main.scss @@ -1,67 +1,50 @@ @charset "utf-8"; -// A NOTE ABOUT FILE PATHS -// -// django.contrib.staticfiles copies this file into the `STATIC_ROOT` -// (along with any other files/directories defined in `STATICFILES_DIRS`) -// and then django-pipeline compiles the Sass files from there. -// -// So imports in this file are relative to `/scoring/sass/main.scss`, -// not `/caps/static/scoring/scss/main.scss`. -// -// That’s why `@import "../../bootstrap5/" works – because at the -// point the Sass files are compiled, django.contrib.staticfiles has -// already copied the bootstrap5 sass files into `/bootstrap5/`. -// -// Note that this doesn't work on a dev thing with standard django-pipeline -// due to this issue: https://github.com/jazzband/django-pipeline/issues/749 -// so we are using a fork with the patch from the above issue - -@import "../../bootstrap5/functions"; -@import "../../bootstrap5/mixins/banner"; +@import "../../bootstrap5/scss/functions"; +@import "../../bootstrap5/scss/mixins/banner"; @include bsBanner(""); @import "variables"; -@import "../../bootstrap5/variables"; +@import "../../bootstrap5/scss/variables"; -@import "../../bootstrap5/maps"; -@import "../../bootstrap5/mixins"; -@import "../../bootstrap5/utilities"; +@import "../../bootstrap5/scss/maps"; +@import "../../bootstrap5/scss/mixins"; +@import "../../bootstrap5/scss/utilities"; @import "_utils"; -@import "../../bootstrap5/root"; -@import "../../bootstrap5/reboot"; -@import "../../bootstrap5/type"; -@import "../../bootstrap5/images"; -@import "../../bootstrap5/containers"; -@import "../../bootstrap5/grid"; -@import "../../bootstrap5/tables"; -@import "../../bootstrap5/forms"; -@import "../../bootstrap5/buttons"; -@import "../../bootstrap5/transitions"; -@import "../../bootstrap5/dropdown"; -@import "../../bootstrap5/accordion"; -@import "../../bootstrap5/button-group"; -@import "../../bootstrap5/nav"; -@import "../../bootstrap5/navbar"; -@import "../../bootstrap5/card"; -// @import "../../bootstrap5/breadcrumb"; -// @import "../../bootstrap5/pagination"; -@import "../../bootstrap5/badge"; -@import "../../bootstrap5/alert"; -// @import "../../bootstrap5/progress"; -@import "../../bootstrap5/list-group"; -@import "../../bootstrap5/close"; -// @import "../../bootstrap5/toasts"; -@import "../../bootstrap5/modal"; -@import "../../bootstrap5/tooltip"; -@import "../../bootstrap5/popover"; -// @import "../../bootstrap5/carousel"; -// @import "../../bootstrap5/spinners"; -// @import "../../bootstrap5/offcanvas"; -// @import "../../bootstrap5/placeholders"; -@import "../../bootstrap5/helpers"; -@import "../../bootstrap5/utilities/api"; +@import "../../bootstrap5/scss/root"; +@import "../../bootstrap5/scss/reboot"; +@import "../../bootstrap5/scss/type"; +@import "../../bootstrap5/scss/images"; +@import "../../bootstrap5/scss/containers"; +@import "../../bootstrap5/scss/grid"; +@import "../../bootstrap5/scss/tables"; +@import "../../bootstrap5/scss/forms"; +@import "../../bootstrap5/scss/buttons"; +@import "../../bootstrap5/scss/transitions"; +@import "../../bootstrap5/scss/dropdown"; +@import "../../bootstrap5/scss/accordion"; +@import "../../bootstrap5/scss/button-group"; +@import "../../bootstrap5/scss/nav"; +@import "../../bootstrap5/scss/navbar"; +@import "../../bootstrap5/scss/card"; +// @import "../../bootstrap5/scss/breadcrumb"; +// @import "../../bootstrap5/scss/pagination"; +@import "../../bootstrap5/scss/badge"; +@import "../../bootstrap5/scss/alert"; +// @import "../../bootstrap5/scss/progress"; +@import "../../bootstrap5/scss/list-group"; +@import "../../bootstrap5/scss/close"; +// @import "../../bootstrap5/scss/toasts"; +@import "../../bootstrap5/scss/modal"; +@import "../../bootstrap5/scss/tooltip"; +@import "../../bootstrap5/scss/popover"; +// @import "../../bootstrap5/scss/carousel"; +// @import "../../bootstrap5/scss/spinners"; +// @import "../../bootstrap5/scss/offcanvas"; +// @import "../../bootstrap5/scss/placeholders"; +@import "../../bootstrap5/scss/helpers"; +@import "../../bootstrap5/scss/utilities/api"; @import "mixins"; @import "buttons"; @@ -77,7 +60,7 @@ @import "awesomplete"; @import "methodology"; @import "toggle-section"; -@import "about"; +//@import "about"; @import "toggle-buttons"; @import "loading-shimmer"; @import "open-graph-preview"; diff --git a/scoring/templates/scoring/base-preview.html b/scoring/templates/scoring/base-preview.html index 7ac9b5abc..82d86e38d 100644 --- a/scoring/templates/scoring/base-preview.html +++ b/scoring/templates/scoring/base-preview.html @@ -1,5 +1,5 @@ {% load static %} -{% load pipeline %} +{% load compress %} @@ -12,7 +12,9 @@ {{ page_title }} - {% stylesheet 'scoring' %} + {% compress css %} + + {% endcompress %} diff --git a/scoring/templates/scoring/base.html b/scoring/templates/scoring/base.html index 25fe756f5..ee9baf765 100644 --- a/scoring/templates/scoring/base.html +++ b/scoring/templates/scoring/base.html @@ -1,5 +1,5 @@ {% load static %} -{% load pipeline %} +{% load compress %} @@ -24,7 +24,9 @@ - {% stylesheet 'scoring' %} + {% compress css %} + + {% endcompress %} {% if GOOGLE_ANALYTICS_SCORECARDS %} diff --git a/scoring/templates/scoring/down.html b/scoring/templates/scoring/down.html index 9be789731..31aad1090 100644 --- a/scoring/templates/scoring/down.html +++ b/scoring/templates/scoring/down.html @@ -1,5 +1,5 @@ {% load static %} -{% load pipeline %} +{% load compress %} @@ -12,7 +12,9 @@ - {% stylesheet 'scoring' %} + {% compress css %} + + {% endcompress %}