Browse Source

Public path

ReviewAppsAssets
Rachael Booth 1 year ago
parent
commit
61479d34ff
  1. 4
      app/frontend/styles/application.scss
  2. 3
      webpack.config.js

4
app/frontend/styles/application.scss

@ -1,9 +1,9 @@
@function frontend-font-url($filename) { @function frontend-font-url($filename) {
@return url("./assets/fonts/" + $filename); @return url("~assets/fonts/" + $filename);
} }
@function frontend-image-url($filename) { @function frontend-image-url($filename) {
@return url("./assets/images/" + $filename); @return url("~assets/images/" + $filename);
} }
$govuk-font-url-function: frontend-font-url; $govuk-font-url-function: frontend-font-url;

3
webpack.config.js

@ -6,6 +6,7 @@ const RemoveEmptyScriptsPlugin = require('webpack-remove-empty-scripts')
const CopyPlugin = require('copy-webpack-plugin') const CopyPlugin = require('copy-webpack-plugin')
const mode = process.env.NODE_ENV === 'development' ? 'development' : 'production' const mode = process.env.NODE_ENV === 'development' ? 'development' : 'production'
const publicPath = process.env.RAILS_RELATIVE_URL_ROOT ?? ''
module.exports = { module.exports = {
mode, mode,
@ -48,7 +49,7 @@ module.exports = {
filename: '[name].js', filename: '[name].js',
// we must set publicPath to an empty value to override the default of // we must set publicPath to an empty value to override the default of
// auto which doesn't work in IE11 // auto which doesn't work in IE11
publicPath: '', publicPath: publicPath,
path: path.resolve(__dirname, 'app/assets/builds') path: path.resolve(__dirname, 'app/assets/builds')
}, },
plugins: [ plugins: [

Loading…
Cancel
Save