From 0056946aa3e0a557631e9256c7e5f47adcfcf80a Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Mon, 4 Apr 2022 16:43:47 +0100 Subject: [PATCH] Unpleasant but works --- app/frontend/application.js | 8 ++------ app/frontend/controllers/govukfrontend_controller.js | 6 ++++-- app/frontend/styles/application.scss | 7 ++----- webpack.config.js | 2 +- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/app/frontend/application.js b/app/frontend/application.js index 708629ad9..4bff5c3e9 100644 --- a/app/frontend/application.js +++ b/app/frontend/application.js @@ -12,13 +12,9 @@ import "custom-event-polyfill" import "intersection-observer" // -// Import GOV.UK Frontend -import GOVUKFrontend from 'govuk-frontend' - -// Import GOV.UK Prototype Components -import GOVUKPrototypeComponents from 'govuk-prototype-components' - require.context("govuk-frontend/govuk/assets") +import GOVUKFrontend from "govuk-frontend" +import GOVUKPrototypeComponents from "govuk-prototype-components" import "./styles/application.scss" import "./controllers" diff --git a/app/frontend/controllers/govukfrontend_controller.js b/app/frontend/controllers/govukfrontend_controller.js index 74af6408a..9fdc001af 100644 --- a/app/frontend/controllers/govukfrontend_controller.js +++ b/app/frontend/controllers/govukfrontend_controller.js @@ -1,8 +1,10 @@ -import { initAll } from "govuk-frontend"; +import GOVUKFrontend from "govuk-frontend"; +import GOVUKPrototypeComponents from "govuk-prototype-components" import { Controller } from "@hotwired/stimulus"; export default class extends Controller { connect() { - initAll() + GOVUKFrontend.initAll() + GOVUKPrototypeComponents.initAll() } } diff --git a/app/frontend/styles/application.scss b/app/frontend/styles/application.scss index f2251ea5d..07e8c675a 100644 --- a/app/frontend/styles/application.scss +++ b/app/frontend/styles/application.scss @@ -10,11 +10,8 @@ $govuk-font-url-function: frontend-font-url; $govuk-image-url-function: frontend-image-url; $govuk-global-styles: true; -// Import GOV.UK Frontend -@import "govuk-frontend/govuk/all"; - -// Import GOV.UK Prototype Components -// @import "govuk-prototype-components/x-govuk/all"; +@import "node_modules/govuk-frontend/govuk/all"; +@import "node_modules/govuk-prototype-components/x-govuk/all"; @import "accessible-autocomplete"; @import "button"; diff --git a/webpack.config.js b/webpack.config.js index 0f7e8f987..14ff8fd36 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -43,7 +43,7 @@ module.exports = { ], }, resolve: { - modules: ['node_modules', 'node_modules/govuk-frontend/govuk', 'node_modules/govuk-prototype-components/x-govuk'] + modules: ['node_modules', 'node_modules/govuk-frontend/govuk'] }, output: { filename: "[name].js",