From 61479d34ff66ed51f7adb85f6b756926e835f666 Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Wed, 6 Dec 2023 17:18:42 +0000 Subject: [PATCH] Public path --- app/frontend/styles/application.scss | 4 ++-- webpack.config.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/frontend/styles/application.scss b/app/frontend/styles/application.scss index 4e8fed711..ddf368807 100644 --- a/app/frontend/styles/application.scss +++ b/app/frontend/styles/application.scss @@ -1,9 +1,9 @@ @function frontend-font-url($filename) { - @return url("./assets/fonts/" + $filename); + @return url("~assets/fonts/" + $filename); } @function frontend-image-url($filename) { - @return url("./assets/images/" + $filename); + @return url("~assets/images/" + $filename); } $govuk-font-url-function: frontend-font-url; diff --git a/webpack.config.js b/webpack.config.js index 597886870..c20ea12bc 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -6,6 +6,7 @@ const RemoveEmptyScriptsPlugin = require('webpack-remove-empty-scripts') const CopyPlugin = require('copy-webpack-plugin') const mode = process.env.NODE_ENV === 'development' ? 'development' : 'production' +const publicPath = process.env.RAILS_RELATIVE_URL_ROOT ?? '' module.exports = { mode, @@ -48,7 +49,7 @@ module.exports = { filename: '[name].js', // we must set publicPath to an empty value to override the default of // auto which doesn't work in IE11 - publicPath: '', + publicPath: publicPath, path: path.resolve(__dirname, 'app/assets/builds') }, plugins: [