penx / govuk-frontend-react

govuk-frontend as React components
4 stars 2 forks source link

Separate templates from CSS modules #14

Open penx opened 5 years ago

penx commented 5 years ago

We currently tie our HTML templates to our CSS modules import/implementation. We want to make HTML templates usable by other CSS techniques at some point in the future - e.g.

However, if you separate out the template from the CSS module import then:

Some work has been done to plan how this could be done:

However this is a large change are raises further questions

What is the smallest evolution we can make in this direction?

=> separate simple components only, i.e. those that don't import other components and don't have any/a lot of elements

=> separate elements in to individual files, pass down styles as a prop to these elements, don't separate template (or at least make css module the default), continue to import other components as css module version for now. Exported versions of elements need to be wrapped to pass down styles.

penx commented 4 years ago

This is too big a rabbit hole for this PoC so will likely be concentrating on a functioning, feature complete CSS modules version before tackling this!