Closed jmjpro closed 6 years ago
@jmjpro are you sure this app_template.js
is correct? To me, it looks like html2ReactParser.parse
doesn't resolve the expression names(AppStyled)
.
Can you try this:
__app_template.js
__:
export default (AppStyledClassName) => `
<div className="${AppStyledClassName}">
hello
</div>
`
app.jsx
:
import { css, names } from 'linaria';
import { Parser as Html2ReactParser } from 'html-to-react'
import appTemplate from './app_template'
const AppStyled = css`
font-weight: bold;
`;
const html2ReactParser = new Html2ReactParser()
const jsx = html2ReactParser.parse(appTemplate(names(AppStyled)))
export default () => {
console.log(jsx)
return jsx
}
Closing due to inactivity.
Do you want to request a feature or report a bug? feature/question
What is the current behavior? When I build my JSX at runtime styles aren't compiled. I get html output of
from the scenario below.
If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can
yarn install
andyarn test
. index.jsapp.jsx
app_template.js
What is the expected behavior? I'm using html-to-react to compile a string to JSX at runtime. When I build my JSX at runtime I would like styles to compiled to get html output like this:
Is there a way I can achieve this by calling invoking the linaria babel plugin programmatically?
Please provide your exact Babel configuration and mention your Linaria, Node, Yarn/npm version and operating system.
. babelrc
node version 8.5.0 yarn version 1.1.0 linaria version ^0.0.2-alpha.0