art-bazhin / babel-plugin-postcss-template-literals

Process tagged template literals with PostCSS
MIT License
5 stars 0 forks source link

Doesn't work with async plugins e.g. TailwindCSS #1

Open ghost opened 5 years ago

ghost commented 5 years ago
How to repro 1. Create the two files: `.babelrc` ``` { "plugins": [ ["postcss-template-literals", { "plugins": [ "tailwindcss" ] }] ] } ``` `tailwind-styles.js` ``` import { css } from 'lit-element'; export const TailwindStyles = css` @tailwind base; @tailwind components; @tailwind utilities; `; ``` 2. Install deps: `npm i --save-dev @babel/cli babel-plugin-postcss-template-literals tailwindcss` 3. Execute: `npx babel ./tailwind-styles.js`
Stacktrace ```javascript Error: Use process(css).then(cb) to work with async plugins at LazyResult.sync (/mnt/c/Users/domen/Documents/Developer/web/mydiscs.com/node_modules/postcss/lib/lazy-result.js:284:15) at LazyResult.stringify (/mnt/c/Users/domen/Documents/Developer/web/mydiscs.com/node_modules/postcss/lib/lazy-result.js:305:10) at LazyResult.get (/mnt/c/Users/domen/Documents/Developer/web/mydiscs.com/node_modules/postcss/lib/lazy-result.js:350:19) at PluginPass.TaggedTemplateExpression (/mnt/c/Users/domen/Documents/Developer/web/mydiscs.com/node_modules/babel-plugin-postcss-template-literals/index.js:37:67) at newFn (/mnt/c/Users/domen/Documents/Developer/web/mydiscs.com/node_modules/@babel/core/node_modules/@babel/traverse/lib/visitors.js:193:21) at NodePath._call (/mnt/c/Users/domen/Documents/Developer/web/mydiscs.com/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:53:20) at NodePath.call (/mnt/c/Users/domen/Documents/Developer/web/mydiscs.com/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:40:17) at NodePath.visit (/mnt/c/Users/domen/Documents/Developer/web/mydiscs.com/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:88:12) at TraversalContext.visitQueue (/mnt/c/Users/domen/Documents/Developer/web/mydiscs.com/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:118:16) at TraversalContext.visitSingle (/mnt/c/Users/domen/Documents/Developer/web/mydiscs.com/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:90:19) ```
art-bazhin commented 5 years ago

Unfortunately Babel doesn't support async plugins yet. https://github.com/babel/babel/issues/9888