tailwindcss-rails 0.3.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -12
- data/Rakefile +1 -0
- data/app/assets/stylesheets/tailwind.css +172209 -158667
- data/lib/generators/tailwindcss/controller/controller_generator.rb +9 -0
- data/lib/generators/tailwindcss/controller/templates/view.html.erb.tt +4 -0
- data/lib/generators/tailwindcss/mailer/mailer_generator.rb +9 -0
- data/lib/generators/tailwindcss/mailer/templates/view.html.erb.tt +5 -0
- data/lib/generators/tailwindcss/mailer/templates/view.text.erb.tt +3 -0
- data/lib/generators/tailwindcss/scaffold/scaffold_generator.rb +34 -0
- data/lib/generators/tailwindcss/scaffold/templates/_form.html.erb.tt +43 -0
- data/lib/generators/tailwindcss/scaffold/templates/edit.html.erb.tt +8 -0
- data/lib/generators/tailwindcss/scaffold/templates/index.html.erb.tt +14 -0
- data/lib/generators/tailwindcss/scaffold/templates/new.html.erb.tt +7 -0
- data/lib/generators/tailwindcss/scaffold/templates/partial.html.erb.tt +22 -0
- data/lib/generators/tailwindcss/scaffold/templates/show.html.erb.tt +15 -0
- data/lib/install/tailwindcss.rb +22 -0
- data/lib/tailwindcss/compressor.rb +9 -2
- data/lib/tailwindcss/engine.rb +5 -0
- data/lib/tailwindcss/purger.rb +94 -34
- data/lib/tailwindcss/version.rb +1 -1
- data/lib/tasks/tailwindcss_tasks.rake +2 -21
- metadata +21 -11
- data/lib/install/stylesheets/application.scss +0 -3
- data/lib/install/tailwindcss_with_asset_pipeline.rb +0 -12
- data/lib/install/tailwindcss_with_webpacker.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 034611e8ea49f35f8fb1f8c04e2a838011cf60f0a3ed532e583f8557b680f505
|
4
|
+
data.tar.gz: 0ec0ffa66dbd906af1021d53e533f448949d48f605505ace7ad04c6d4fa3d557
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfe791a46dfad464601c97c582dffcc415aae9525602bf892f6fafeb6aca3ba1f799161d5967958f0b3ad03201ca0537978f75add6afb64435cdb79372056d1f
|
7
|
+
data.tar.gz: 67bca0ab9ccaab58eecbc021175b79dfdab7df5bad4a8fbde909fc957c85516521260b6a3252fbfe7d16ab3bc99d12e7bfb018a851165bb82d9c5a8412c40627
|
data/README.md
CHANGED
@@ -2,32 +2,28 @@
|
|
2
2
|
|
3
3
|
[Tailwind CSS](https://tailwindcss.com) is a utility-first CSS framework packed with classes like flex, pt-4, text-center and rotate-90 that can be composed to build any design, directly in your markup.
|
4
4
|
|
5
|
-
Tailwind CSS for
|
5
|
+
This gem gives access to the standard Tailwind CSS framework configured for dark mode, forms, aspect-ratio, typography, and the Inter font via the asset pipeline using Sprockets (and soon [Propshaft](https://github.com/rails/propshaft)).
|
6
6
|
|
7
|
-
|
7
|
+
If you need to customize Tailwind, you will need to install it under a full JavaScript bundling setup, such as [cssbundling-rails](https://github.com/rails/cssbundling-rails). This gem was specifically designed not to require a Node.js environment. If you're already using such an environment, you won't need this gem.
|
8
8
|
|
9
|
-
|
9
|
+
Production-mode purging of unused css class names is provided by a Sprockets compressor built into this gem. This compressor ensures that only the css classes used by files in `app/views` and `app/helpers` are included. In development mode, the full 7mb+ Tailwind stylesheet is loaded.
|
10
10
|
|
11
11
|
|
12
12
|
## Installation
|
13
13
|
|
14
14
|
1. Run `./bin/bundle add tailwindcss-rails`
|
15
|
-
2. Run `./bin/rails tailwindcss:install`
|
15
|
+
2. Run `./bin/rails tailwindcss:install`
|
16
16
|
|
17
|
-
|
17
|
+
The last step adds the purger compressor to `config/environments/production.rb`. This ensures that when `assets:precompile` is called during deployment that the unused class names are not included in the tailwind output css used by the app. It also adds a `stylesheet_link_tag "tailwind"` and `stylesheet_link_tag "inter-font"` to your `app/views/layouts/application.html.erb` file.
|
18
18
|
|
19
19
|
You can do these things yourself, if you've changed the default setup.
|
20
20
|
|
21
|
-
Note: You should ensure to delete `app/assets/stylesheets/scaffolds.scss` that Rails adds after running a scaffold command, if you had run this generator before installing Tailwind CSS for Rails. This stylesheet will interfere with Tailwind's reset of base styles. This gem will turn off stylesheet generation for all future scaffold runs.
|
22
|
-
|
23
|
-
When run on an app using Webpacker, the last step adds the npm dependencies for Tailwind CSS, configures postCSS, and generates a app/javascript/stylesheets/application.scss file as the default for using Tailwind.
|
24
|
-
|
25
21
|
|
26
22
|
## Purging in production
|
27
23
|
|
28
|
-
The Tailwind CSS framework starts out as a massive file, which gives you all the combinations of utility classes for development, but you wouldn't want to ship all those unused classes in production. So this gem
|
24
|
+
The Tailwind CSS framework starts out as a massive file, which gives you all the combinations of utility classes for development, but you wouldn't want to ship all those unused classes in production. So the Sprockets compressor included in this gem is used to purge the tailwind file from all those unused classes for production.
|
29
25
|
|
30
|
-
This compressor is currently not compatible with the default Sprockets cache system due to the fact its output depends on files outside of Sprockets (all the files observed for utility class name usage), so this cache is disabled in production. If you need to disable it in other deployed environments, add the following to that environment configuration file:
|
26
|
+
Note: This compressor is currently not compatible with the default Sprockets cache system due to the fact its output depends on files outside of Sprockets (all the files observed for utility class name usage), so this cache is disabled in production. If you need to disable it in other deployed environments, add the following to that environment configuration file:
|
31
27
|
|
32
28
|
```ruby
|
33
29
|
Rails.application.config.assets.configure do |env|
|
@@ -51,8 +47,19 @@ By default, the CSS purger will only operate on the tailwind css file included w
|
|
51
47
|
```
|
52
48
|
|
53
49
|
|
50
|
+
## Tailwind versions
|
51
|
+
|
52
|
+
The Tailwind CSS main file that's being used before purging consists of these versions:
|
53
|
+
|
54
|
+
* @tailwindcss/aspect-ratio 0.2.1
|
55
|
+
* @tailwindcss/forms 0.3.3
|
56
|
+
* @tailwindcss/typography 0.4.1
|
57
|
+
* autoprefixer 10.3.1
|
58
|
+
* tailwindcss 2.2.15
|
59
|
+
|
60
|
+
|
54
61
|
## License
|
55
62
|
|
56
63
|
Tailwind for Rails is released under the [MIT License](https://opensource.org/licenses/MIT).
|
57
64
|
Tailwind CSS is released under the [MIT License](https://opensource.org/licenses/MIT).
|
58
|
-
The Inter font is released under the [SIL Open Font License, Version 1.1](https://github.com/rsms/inter/blob/master/LICENSE.txt).
|
65
|
+
The Inter font is released under the [SIL Open Font License, Version 1.1](https://github.com/rsms/inter/blob/master/LICENSE.txt).
|