This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { stitch } from './vanilla-stitches-runtime'; | |
import { stackPattern, buttonPattern } from './styles.css'; | |
const button = stitch(buttonPattern); | |
const stack = stitch(stackPattern); | |
document.body.innerHTML = ` | |
<div class="${stack({ space: 'xlarge' })}"> | |
<div class="${stack({ space: 'small' })}"> | |
<button class="${button()}">Button</button> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { createMacro, MacroError } = require('babel-plugin-macros'); | |
const { default: generate } = require('@babel/generator'); | |
function stringify({ references, babel }) { | |
const { types: t } = babel; | |
references.default.forEach(({ parentPath }) => { | |
if (!t.isCallExpression(parentPath.node)) { | |
throw new MacroError('stringify must be a CallExpression'); | |
} |