Skip to content

Commit 9fb30e3

Browse files
committed
Documented Tailwind CSS setup and usage details in README.md.
1 parent f54c5d8 commit 9fb30e3

1 file changed

Lines changed: 54 additions & 13 deletions

File tree

README.md

Lines changed: 54 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This is the [Jekyll](http://www.jekyllrb.com/) source code for the official [Rub
1414
### Prerequisites
1515

1616
- **Ruby** (latest stable version recommended) - [Install Ruby](https://www.ruby-lang.org/en/documentation/installation/)
17+
- **Node.js** (for Tailwind CSS) - [Install Node.js](https://nodejs.org/)
1718
- **Git** - [Install Git](https://git-scm.com/downloads)
1819

1920
### Get It Running
@@ -29,6 +30,7 @@ This is the [Jekyll](http://www.jekyllrb.com/) source code for the official [Rub
2930
cd www.ruby-lang.org/
3031
bundle config set --local without production
3132
bundle install
33+
npm install
3234
```
3335

3436
3. **Start the development server**:
@@ -65,10 +67,61 @@ This is the [Jekyll](http://www.jekyllrb.com/) source code for the official [Rub
6567
# Quick development server (faster rebuilds)
6668
bundle exec jekyll serve --watch --future --incremental
6769

70+
# development server (faster rebuilds, but may miss CSS changes)
71+
bundle exec jekyll serve --watch --future
72+
6873
# Full build (for testing)
6974
bundle exec rake build
7075
```
7176

77+
⚠️ **About `--incremental` flag**: While it speeds up rebuilds, it can sometimes miss changes due to caching. If your changes aren't appearing:
78+
1. Try restarting the server
79+
2. If that doesn't work, clean the cache:
80+
```sh
81+
rm -rf _site .jekyll-cache
82+
bundle exec jekyll serve --watch --future
83+
```
84+
85+
### 🎨 Working with Tailwind CSS
86+
87+
This site uses [Tailwind CSS](https://tailwindcss.com/) via [jekyll-postcss-v2](https://github.com/mhanberg/jekyll-postcss-v2).
88+
89+
**CSS is automatically processed during Jekyll builds**, so you don't need to run separate commands in most cases.
90+
91+
#### CSS File Structure
92+
- `stylesheets/main.css` - Main CSS file (imports all others + Tailwind)
93+
- `stylesheets/variables.css` - CSS custom properties
94+
- `stylesheets/components/*.css` - Component-specific styles
95+
96+
#### When CSS Changes Don't Apply
97+
98+
If you modify `stylesheets/components/*.css` or `variables.css` and changes aren't reflected:
99+
100+
1. **Without `--incremental`**: Changes should be detected automatically
101+
2. **With `--incremental`**: Restart Jekyll first
102+
```sh
103+
# Stop the server (Ctrl+C) and restart
104+
bundle exec jekyll serve --watch --future --incremental
105+
```
106+
3. **Still not working?** Clean build cache and restart (this always works):
107+
```sh
108+
rm -rf _site .jekyll-cache
109+
bundle exec jekyll serve --watch --future
110+
```
111+
112+
💡 **Tip**: For CSS-heavy development, consider using `--watch --future` without `--incremental` for more reliable change detection.
113+
114+
#### How It Works
115+
116+
CSS processing happens automatically via PostCSS:
117+
- `postcss-import` - Combines all CSS files into one
118+
- `tailwindcss` - Processes Tailwind utilities based on HTML/Markdown content
119+
- `autoprefixer` - Adds vendor prefixes for browser compatibility
120+
121+
Configuration files:
122+
- `tailwind.config.js` - Tailwind configuration
123+
- `postcss.config.js` - PostCSS plugins
124+
72125
### Testing Your Changes
73126

74127
**Important**: Always run the full test suite before submitting a pull request:
@@ -123,24 +176,12 @@ If you can't build locally or want to test under production conditions:
123176
- **Found a bug?** [Open an issue](https://github.com/ruby/www.ruby-lang.org/issues)
124177
- **Need more info?** Check the [project wiki](https://github.com/ruby/www.ruby-lang.org/wiki)
125178

126-
## Styling with Tailwind CSS
127-
128-
This site uses [Tailwind CSS](https://tailwindcss.com/) for styling.
129-
After making changes to HTML/Markdown files or Tailwind configuration:
130-
131-
``` sh
132-
npm run build-css # build CSS
133-
npm run watch-css # watch and rebuild CSS automatically
134-
```
135-
136-
**Note:** You need to have Node.js installed to run these commands.
137-
138179

139180
## Testing
140181

141182
Besides generating and previewing the site
142183
you can perform additional tests with these tasks:
143-
184+
144185
``` sh
145186
bundle exec rake lint # run linter on markdown files
146187
bundle exec rake check:markup # check markup for all generated pages

0 commit comments

Comments
 (0)