pre-style
pre-style copied to clipboard
Add PreStyle method-like syntax and utility
Where all template strings are treated as code blocks. Optionally import on PreStyle for a simple method that filters and joins strings.
Example:
import PreStyle from 'pre-style';
const attrs = {
className: PreStyle(
`
font-weight: bold;
text-align: center;
`,
(val === 0 && `color: $color1;`),
(val === 1 && `color: $color2;`),
(val === 2 && `color: $color3;`)
)
};
Would Become:
import PreStyle from 'pre-style';
const attrs = {
className: PreStyle("A B", "C", "D", "E") //"C", "D" or "E" depending on which is true. Falsey values are stripped by PreStyle method
};