-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add tailwind css #98
Conversation
@@ -3,3 +3,4 @@ | |||
node_modules/ | |||
book | |||
.DS_Store | |||
css/tailwind.css |
There was a problem hiding this comment.
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"' |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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}"], |
There was a problem hiding this comment.
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%; |
There was a problem hiding this comment.
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
theme/css/tailwind.css
Outdated
There was a problem hiding this comment.
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
@@ -0,0 +1,20 @@ | |||
# Preprocessors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me!
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
Steps to Verify:
npm i
mdbook serve
Screenshots (optional):