Skip to content

how to send css while sending component as json ? #8965

Answered by wongjn
geminigeek asked this question in Help
Discussion options

You must be logged in to vote

Tailwind isn't really equipped for incremental builds like this, but what I think is that you would have to run Tailwind every time you send through one of these JSON packets. Instead of using tailwind.config.js, you could run postcss with the Tailwind plugin and pass the Tailwind config inline. This gives you the chance to send the classes directly:

const postcss = require('postcss');
const tailwind = require('tailwindcss');

/**
 * Generates Tailwind CSS from given class names.
 *
 * @param {string} classNames Space-separated list of strings.
 * @return {LazyResult} The process result.
 */
module.exports = classNames => postcss([tailwind({ safelist: classNames.split(' ') })])
  .process('…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@geminigeek
Comment options

Answer selected by geminigeek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants