question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

API render not including Tailwind styles for components and layouts.

See original GitHub issue

Related issue: #565

  • Maizzle Version: 4.0.2
  • Node.js Version: v14.19.3 (in Codesandbox) and v16.14.1 (in my Dev Machine)
  • Reproducible Repo

Firstly, thank you for making this framework. It makes developing email templates a breeze.

The issue I am reporting is similar to #565 (most likely the same). After going through that issue I realized that no one provided a reproducible repository for it. So have provided the same below.

The gist/summary of #565 issue (so you don’t have to go through that entire thread all over again):

  1. Tailwind styles are output correctly in page.css placeholder in Dev server running through maizzle serve.
  2. Tailwind styles are not output correctly in page.css placeholder when using API. And it affects only Layouts and Components. Tailwind styles are correctly applied to Templates.

To reproduce this issue, please open the Codesandbox Sandbox I have created here. I have linked directly to the README so you will be able to follow the instructions there.

Have also attached screenshots of the steps involved in getting the Sandbox up and running for your convenience (if you get stuck anywhere please don’t hesitate to holler at me):

  1. By default, the Node sandbox server runs whatever is preconfigured with the Template itself. Ignore that port.
  2. Open two new terminal tabs in the Codesandbox environment like so:

SCR-20220807-3xc

  1. In the first Terminal tab, navigate to the “maizzle” sub-directory and install NPM dependencies. Run the following commands:
$ cd maizzle
$ npm i

As shown below:

image
  1. Then run the dev server from within the “maizzle” sub-directory. You will be prompted with a popup asking your permission to open a new browser tab pointing to Port 4000. Please confirm.
$ npm run dev

Shown below:

image
  1. New browser tab opens within the Sandbox which presents you with the file browser UI. Please click on confirm-user.html link. It should load the template perfectly as shown below:
image
  1. Now click on the second terminal and run the following command:
$ node maizzle-test.js
image
  1. It should prompt you to open a new browser pane. Please confirm.
image
  1. The browser pane should open automatically and you should be presented with the output from API service. As you can see, the styles do not render for both “layouts”, “components”. Essentially anything that is extended/imported.
image
  1. Inspecting the Frame source, these are the only styles from Tailwind that are applied (note that all of them only belong to the classnames of elements defined within the “Template”. They do not include any classnames from either the “layout” or the “component”.
image

This makes me wonder if the Tailwind styles are being applied only for the Template string that is passed to the “render” API and is not waiting for the final HTML to be rendered (after fetching “layout” and “component” HTML and merging it with the “template”).

I haven’t dug into the source. But first wanted to provide a reproducible repo and log the issue.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
cossssmincommented, Aug 9, 2022

Hey thanks for the detailed report 😃

You need to tell Tailwind to scan your layouts and components directories - when using the API, these are not pre-set like they are with the CLI command.

image
2reactions
Jank1310commented, Aug 13, 2022

Had the same problem as @shripadk. It would be great if some notice regarding this could be added to the “gotchas” section in https://maizzle.com/docs/api 👀

Read more comments on GitHub >

github_iconTop Results From Across the Web

Content Configuration - Tailwind CSS
Configuring source paths. Tailwind CSS works by scanning all of your HTML, JavaScript components, and any other template files for class names, ...
Read more >
Tailwind CSS classes is not working in my project?
This error is due to tailwind not finding any classes to scan in what it 'thinks' is your HTML code directories.
Read more >
Storybook is not applying Tailwind CSS styles when working ...
When I use yarn rw storybook the styles applied from my project are not applied in storybook to the component. I'm not sure...
Read more >
Tailwind CSS Tips, Tricks & Best Practices - YouTube
This is a cross-post from our Virtual EmberConf 2020 Tailwind CSS ... [3] Tailwind -friendly UI Component APIs 33:14 – [4] Layout with ......
Read more >
Styling - Remix
When the route is no longer active, the stylesheet is removed. ... the styles of a component without needing to add an official...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found