Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tailwind css #98

Merged
merged 4 commits into from
Nov 7, 2024
Merged

Add tailwind css #98

merged 4 commits into from
Nov 7, 2024

Conversation

wilwade
Copy link
Contributor

@wilwade wilwade commented Nov 7, 2024

Problem

It was hard to copy components into docs without re-writing all the tailwind into custom css. This enables tailwind css for us!

Solution

  • Added tailwind via npx command preprocessor
  • Split up the other preprocessors for easier use
  • Updated to the new footer using tailwind
  • Reset rem to 100% as tailwind assumes that (and moved rem based things to px).

Steps to Verify:

  1. npm i
  2. mdbook serve

Screenshots (optional):

image

@@ -3,3 +3,4 @@
node_modules/
book
.DS_Store
css/tailwind.css
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generated file


[preprocessor.tailwind]
renderers = ["html"]
command = 'node preprocessors/noop-npx.mjs "npx -y tailwindcss -i ./theme/css/tailwind.css -o ./css/tailwind.css"'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why noop-npx.mjs? Noop because it doesn't adjust the book contents like other preprocessors do. This is just used as a trigger to re-run the tailwind build script

"css/side-nav.css",
"css/header.css",
"css/footer.css",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All tailwind standard now, so almost copy paste from svelte generated code.

package.json Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newer npm reformatted.


/** @type {import('tailwindcss').Config} */
export default {
content: ["./theme/**/*.{html,hbs}"],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice the hbs in here now.

/* Browser default font-size is 16px, this way 1 rem = 10px */
font-size: 62.5%;
/* Browser default font-size is 16px */
font-size: 100%;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tailwind relies on rem, so had to swap it to the default

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Styles here are copied from the index.css from the style-guide

@wilwade wilwade changed the title Dp/add tailwind css Add tailwind css Nov 7, 2024
@wilwade wilwade enabled auto-merge (squash) November 7, 2024 21:53
@@ -0,0 +1,20 @@
# Preprocessors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

Copy link
Contributor

@shannonwells shannonwells left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me!

@wilwade wilwade merged commit e7c2d6a into developer-portal Nov 7, 2024
1 check passed
@wilwade wilwade deleted the dp/add-tailwind-css branch November 7, 2024 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants