diff --git a/PyRIGS/settings.py b/PyRIGS/settings.py index 7f49f311..60ce218a 100644 --- a/PyRIGS/settings.py +++ b/PyRIGS/settings.py @@ -87,12 +87,13 @@ MIDDLEWARE = ( 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'htmlmin.middleware.HtmlMinifyMiddleware', + 'htmlmin.middleware.MarkRequestMiddleware', ) ROOT_URLCONF = 'PyRIGS.urls' WSGI_APPLICATION = 'PyRIGS.wsgi.application' -STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' # Database # https://docs.djangoproject.com/en/1.7/ref/settings/#databases @@ -235,12 +236,14 @@ DATETIME_INPUT_FORMATS = ('%Y-%m-%dT%H:%M', '%Y-%m-%dT%H:%M:%S') STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static/') -STATIC_DIRS = ( - os.path.join(BASE_DIR, 'static/') -) -STATICFILES_DIRS = [ - os.path.join(BASE_DIR, 'pipeline/built_assets/'), +STATIC_DIRS = [ + os.path.join(BASE_DIR, 'static/'), ] +STATICFILES_DIRS = [ + os.path.join(BASE_DIR, 'pipeline/built_assets'), +] +STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' +WHITENOISE_KEEP_ONLY_HASHED_FILES=True TEMPLATES = [ { diff --git a/gulpfile.js b/gulpfile.js index e5df960a..ca33802a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -61,7 +61,7 @@ function scripts() { } function browserSync(done) { - spawn('python', ['manage.py', 'runserver'], {stdio: 'inherit'}); + spawn('python', ['manage.py', 'runserver', '--nostatic'], {stdio: 'inherit'}); // TODO Wait for Django server to come up before browsersync, it seems inconsistent browsersync.init({ notify: true, @@ -77,9 +77,8 @@ function browserSyncReload(done) { } function watchFiles() { - gulp.watch("RIGS/static/scss/**/*.scss", styles); - // TODO This prevents reload looping, but means we don't reload if new third party scripts are added - gulp.watch("RIGS/static/js/src/**/*.js", scripts); + gulp.watch("pipeline/source_assets/scss/**/*.scss", styles); + gulp.watch("pipeline/source_assets/js/**/*.js", scripts); gulp.watch("**/templates/*.html", browserSyncReload); } diff --git a/requirements.txt b/requirements.txt index 6ba7b2a6..00c446d4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,7 @@ asgiref==3.3.1 backports.tempfile==1.0 backports.weakref==1.0.post1 beautifulsoup4==4.9.3 +Brotli==1.0.9 cachetools==4.2.1 certifi==2020.12.5 chardet==4.0.0 @@ -18,14 +19,13 @@ django-debug-toolbar==3.2 django-filter==2.4.0 django-gulp==4.1.0 django-ical==1.7.1 -django-livereload==1.7 -django-livereload-server==0.3.2 django-recaptcha==2.0.6 django-recurrence==1.10.3 django-registration-redux==2.9 django-reversion==3.0.9 django-toolbelt==0.0.1 django-widget-tweaks==1.4.8 +django-htmlmin==0.11.0 envparse==0.2.0 gunicorn==20.0.4 icalendar==4.0.7