You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
first of all, thank you for a great work you are doing!
I have a (may be not very) specific requirement:
there is a global styles.css file where the @tailwind (base, components, utilities) directives are used
there is a react app that normally uses the tailwind
there are HTML snippets, that are first known in the runtime, because they come from external CMS and are subjects of being updated
Problem is, of course, that HTML snippets from the last point aren't scanned by Tailwind and it happens that the classes that are used in these HTML snippets are missing (and this is totally correct)
Is this possible anyhow (with a fair effort) to run Tailwind as a function, where the HTML is passed in and the output has the required Tailwind classes? Ideally there is a function
that scans htmlSnippet, rootCss (the one with @tailwind directives) and creates an output CSS file and then subtracts the classes that are already present in alreadyBuiltCss (as a string or a path to the production CSS file).
The only thing that comes to mind is to save the snippets as files and run the postcss e.g. in a child process to process corresponding CSS files, this sounds however a little bit unperformant. The real files are required by content configuration setting in tailwind.config.js, aren't they? Can the html content be passed elsehow?
Could you guide into a better direction please? Maybe some example to look at?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
first of all, thank you for a great work you are doing!
I have a (may be not very) specific requirement:
Problem is, of course, that HTML snippets from the last point aren't scanned by Tailwind and it happens that the classes that are used in these HTML snippets are missing (and this is totally correct)
Is this possible anyhow (with a fair effort) to run Tailwind as a function, where the HTML is passed in and the output has the required Tailwind classes? Ideally there is a function
that scans
htmlSnippet
,rootCss
(the one with @tailwind directives) and creates an output CSS file and then subtracts the classes that are already present inalreadyBuiltCss
(as a string or a path to the production CSS file).The only thing that comes to mind is to save the snippets as files and run the
postcss
e.g. in a child process to process corresponding CSS files, this sounds however a little bit unperformant. The real files are required bycontent
configuration setting intailwind.config.js
, aren't they? Can the html content be passed elsehow?Could you guide into a better direction please? Maybe some example to look at?
Beta Was this translation helpful? Give feedback.
All reactions