Provides a javascript library for creating raw html (string), using "styled components" like syntax.
Install from NPM
npm i @mountainpass/html-styled-components
const { styled, generateCssClasses } = require('@mountainpass/html-styled-components').newInstance()
const CustomH1 = styled.h1`
border: 1px solid blue;
`
const html = `<html><head><style>${generateCssClasses()}</style></head><body>${CustomH1('Hello world!')}</body></html>`
Output
<html>
<head>
<style>
.c100 {
border: 1px solid blue;
}
</style>
</head>
<body>
<h1 class="c100">Hello world!</h1>
</body>
</html>
Please see the unit tests for all usage examples.
Please see the unit tests for all configuration examples.
Apache 2.0 © nickgrealy