tailwindcss-rails 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -7
- data/lib/tailwindcss/purger.rb +2 -2
- data/lib/tailwindcss/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f354ae7802c5744ba28ece4ee53ca032f49b0b38fa97376f6ab910a3ba33744
|
4
|
+
data.tar.gz: e69831fa1b30f18c1eb11758966dbe52c057e745e8d47b82c890afe62f628535
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33fdc4ca096f78935fc9ba17a884971fbf51e3e45ff439dfd09eb50c2c8b78e49a39fb55aae1d1fe7124817ce69f1fd9651b458616ddc08bda3a1ac12e8aec62
|
7
|
+
data.tar.gz: a2052365bc20ef8fae2017cce0f9a4c6fa7ab94b95ca087e62b8d7051cee3632d51815e8db71fac0a2f9278130f72d3fbc8e6cf8b3ba2c75224eb1b758d02451
|
data/README.md
CHANGED
@@ -2,17 +2,15 @@
|
|
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
|
-
This gem
|
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. If you need to customize Tailwind, you will need to install it the traditional way using [Webpacker](https://github.com/rails/webpacker) instead or use webpacker port of this gem [tailwindcss-rails-webpacker](https://github.com/WizardComputer/tailwindcss-rails-webpacker).
|
6
6
|
|
7
|
-
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
|
8
|
-
|
9
|
-
In both cases, Tailwind CSS is configured for dark mode, forms, aspect-ratio, typography, and the Inter font. If you need more configuration than that, you'll need to use it with Webpacker.
|
7
|
+
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
8
|
|
11
9
|
|
12
10
|
## Installation
|
13
11
|
|
14
12
|
1. Run `./bin/bundle add tailwindcss-rails`
|
15
|
-
2. Run `./bin/rails tailwindcss:install`
|
13
|
+
2. Run `./bin/rails tailwindcss:install`
|
16
14
|
|
17
15
|
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
16
|
|
@@ -21,9 +19,9 @@ You can do these things yourself, if you've changed the default setup.
|
|
21
19
|
|
22
20
|
## Purging in production
|
23
21
|
|
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 this gem
|
22
|
+
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.
|
25
23
|
|
26
|
-
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:
|
24
|
+
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:
|
27
25
|
|
28
26
|
```ruby
|
29
27
|
Rails.application.config.assets.configure do |env|
|
data/lib/tailwindcss/purger.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Tailwindcss::Purger
|
4
|
-
CLASS_NAME_PATTERN = /[:A-Za-z0-9_-]+[
|
4
|
+
CLASS_NAME_PATTERN = /((?:[:A-Za-z0-9_-]+[\\\/:A-Za-z0-9_-]*[0-3][\\.]*5)|(?:[A-Za-z0-9_-]+[\\\/:A-Za-z0-9_-]*))/
|
5
5
|
|
6
6
|
CLASS_BREAK = /(?![-_a-z0-9\\])/i # `\b` for class selectors
|
7
7
|
|
@@ -29,7 +29,7 @@ class Tailwindcss::Purger
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def extract_class_names(string)
|
32
|
-
string.scan(CLASS_NAME_PATTERN).uniq.sort!
|
32
|
+
string.scan(CLASS_NAME_PATTERN).flatten.uniq.sort!
|
33
33
|
end
|
34
34
|
|
35
35
|
def extract_class_names_from(files)
|
data/lib/tailwindcss/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tailwindcss-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|