Skip to content

Commit

Permalink
Setup a templating engine
Browse files Browse the repository at this point in the history
We need to have a reproducible way of handling React elements through
out the system. This is required to handle things like GOV.UK Frontend,
Page Titles, global CSRF tokens and similar shared elements.

We're also Reactifying the first piece of the system.

We have to sadly override some of the JSX interfaces globally, due to
some HTML backwards supportability. [See here][1]

[1]: alphagov/govuk-frontend#1688
  • Loading branch information
paroxp committed Jan 10, 2020
1 parent 532051f commit cbf4487
Show file tree
Hide file tree
Showing 12 changed files with 1,263 additions and 28 deletions.
4 changes: 4 additions & 0 deletions config/jest/enzyme.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const { configure } = require('enzyme');
const Adapter = require('enzyme-adapter-react-16');

configure({ adapter: new Adapter() });
12 changes: 3 additions & 9 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ let cfg = {
},

resolve: {
extensions: ['.ts', '.js', '.json']
extensions: ['.ts', '.tsx', '.js', '.json']
},

module: {
Expand Down Expand Up @@ -109,22 +109,16 @@ let cfg = {
includePaths: ['@govuk-frontend/govuk/components'],
configure: path.resolve(__dirname, './nunjucks.config.js')
}
},
{
loader: 'html-loader',
options: {
attrs: ['img:src', 'link:href', 'script:src']
}
}
]
},
{
test: /\.ts/,
test: /\.(ts(x?))/,
use: [
{
loader: 'ts-loader',
options: {
reportFiles: [/(?<!\.test)\.ts/]
reportFiles: [/(?<!\.test)\.ts(x?)/]
}
}
]
Expand Down
Loading

0 comments on commit cbf4487

Please sign in to comment.