Skip to content

Instantly share code, notes, and snippets.

@mattcompiles
mattcompiles / app.ts
Created March 26, 2021 10:13
vanilla-extract - Stitches style API demo
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>
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');
}