File tree 2 files changed +31
-1
lines changed 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
10
10
11
11
For a steady stream of TILs, [ sign up for my newsletter] ( https://crafty-builder-6996.ck.page/e169c61186 ) .
12
12
13
- _ 1560 TILs and counting..._
13
+ _ 1561 TILs and counting..._
14
14
15
15
See some of the other learning resources I work on:
16
16
- [ Ruby Operator Lookup] ( https://www.visualmode.dev/ruby-operators )
@@ -1037,6 +1037,7 @@ See some of the other learning resources I work on:
1037
1037
- [ Query A Single Value From The Database] ( rails/query-a-single-value-from-the-database.md )
1038
1038
- [ Read In Environment-Specific Config Values] ( rails/read-in-environment-specific-config-values.md )
1039
1039
- [ Read-Only Models] ( rails/read-only-models.md )
1040
+ - [ Rebuild Tailwind Bundle For Dev Server] ( rails/rebuild-tailwind-bundle-for-dev-server.md )
1040
1041
- [ Remove A Database Column From A Table] ( rails/remove-a-database-column-from-a-table.md )
1041
1042
- [ Remove The Default Value On A Column] ( rails/remove-the-default-value-on-a-column.md )
1042
1043
- [ Render An Alternative ActionMailer Template] ( rails/render-an-alternative-action-mailer-template.md )
Original file line number Diff line number Diff line change
1
+ # Rebuild Tailwind Bundle For Dev Server
2
+
3
+ If you're using the TailwindCSS gem in your Rails app:
4
+
5
+ ``` ruby
6
+ # Use Tailwind CSS [https://github.com/rails/tailwindcss-rails]
7
+ gem " tailwindcss-rails"
8
+ ```
9
+
10
+ you may find that as you add and adjust styles in your views, refreshing the
11
+ page doesn't take any styling effects. That is because the tailwind bundle gets
12
+ built with just the style rules that were used at the time it was generated.
13
+
14
+ In development, as we're working, we expect the styles used by our app to
15
+ actively changed. And we don't mind a little performance hit to have the bundle
16
+ rebuilt. In that case, we can instruct ` puma ` to _ Live Rebuild_ in
17
+ ` development ` with the ` tailwindcss ` plugin.
18
+
19
+ ``` ruby
20
+ # config/puma.rb
21
+
22
+ # Enable TailwindCSS rebuild in development
23
+ plugin :tailwindcss if ENV .fetch(" RAILS_ENV" , " development" ) == " development"
24
+ ```
25
+
26
+ This has ` rails server ` run a watch process in the background that live
27
+ rebuilds the bundle.
28
+
29
+ [ source] ( https://github.com/rails/tailwindcss-rails?tab=readme-ov-file#puma-plugin )
You can’t perform that action at this time.
0 commit comments