tailwindcss-rails 0.3.1 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02103a11966729f1d12ce639508812723041e0b31eb16d1975eb7a8b0e51d127
4
- data.tar.gz: 6efcf452cfa585413a954607fa4558485fa8014b80de52bd8a3e1ffbb30a50a9
3
+ metadata.gz: 9a23aa96ec3c3b061d372150421858f794226f56ab7acadd4db92e949757ab16
4
+ data.tar.gz: '0219635fa13a0a7abc84ec4897260cfeb4f207b46a02accd72424f277dbb0027'
5
5
  SHA512:
6
- metadata.gz: 1cde59ad3bd2cdbf6965e06aff1cc87523ea0e777944623e5f1dd3d9842b74f4171659f1f5436220f7fe2f5ac3dee412fb70d5f3aeb19ab75d52386e334b3ea8
7
- data.tar.gz: 98cae3c85094323de192bcb1f8efd345c59b9d1357c0281fb3b102bb86a1bb2bd10ca7cac17f5f3a3562507b0f80316a7264277d4f4ce49a8968ec335940910e
6
+ metadata.gz: 44d99ac7a29ed5ba163b52c5a9b9f835c71d5ee73826a6462133c8966d50ee219a826a4078912b092e1a0c4b5931744029cf97a3132c3e3725e20cb8816710a4
7
+ data.tar.gz: 6755c08c948f909bf39f6bcf25d6ee48408e75e0e8d7ed18360043c8791dedc9fbdcfa52e6d980b66518a38258dcce20c0d9d32a8fb8627728ada2c583e5a8b6
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Tailwind CSS for Rails works with both the asset pipeline and Webpacker.
6
6
 
7
- When use with the asset pipeline, 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 3mb+ Tailwind stylsheet is loaded. 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
+ When use with the asset pipeline, 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 3mb+ Tailwind stylesheet is loaded. 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.
8
8
 
9
9
  When used with Webpacker, Tailwind CSS is installed as a postCSS processor. Refer to the [TailwindCSS documentation](https://tailwindcss.com/docs/installation#customizing-your-configuration) to customize your tailwind.config.js file.
10
10
 
@@ -18,7 +18,7 @@ When run on an app using the just the asset pipeline, the last step adds the pur
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/scaffold.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.
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
22
 
23
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
24
 
@@ -41,7 +41,7 @@ end
41
41
  If you need to customize what files are searched for class names when using the asset pipeline, you need to replace the compressor line with something like:
42
42
 
43
43
  ```ruby
44
- config.assets.css_compressor = Tailwindcss::Compressor.new(files_with_class_names: Rails.root.glob("app/somehere/**/*.*"))
44
+ config.assets.css_compressor = Tailwindcss::Compressor.new(files_with_class_names: Rails.root.glob("app/somewhere/**/*.*"))
45
45
  ```
46
46
 
47
47
  By default, the CSS purger will only operate on the tailwind css file included with this gem. If you want to use it more broadly:
@@ -55,4 +55,4 @@ By default, the CSS purger will only operate on the tailwind css file included w
55
55
 
56
56
  Tailwind for Rails is released under the [MIT License](https://opensource.org/licenses/MIT).
57
57
  Tailwind CSS is released under the [MIT License](https://opensource.org/licenses/MIT).
58
- The Inter font is relased under the [SIL Open Font License, Version 1.1](https://github.com/rsms/inter/blob/master/LICENSE.txt).
58
+ The Inter font is released under the [SIL Open Font License, Version 1.1](https://github.com/rsms/inter/blob/master/LICENSE.txt).
@@ -1,19 +1,17 @@
1
- LATEST_WEBPACKER = "\"@rails\/webpacker\": \"rails\/webpacker#b6c2180\","
2
1
  WEBPACK_STYLESHEETS_PATH = "#{Webpacker.config.source_path}/stylesheets"
3
2
  APPLICATION_LAYOUT_PATH = Rails.root.join("app/views/layouts/application.html.erb")
4
3
 
5
- # Current webpacker version relies on an older version of PostCSS
6
- # which the latest TailwindCSS version is not compatible with
7
- gsub_file("package.json", /\"@rails\/webpacker\".*/) { |matched_line| matched_line = LATEST_WEBPACKER }
4
+ say "Installing Tailwind CSS"
5
+ run "yarn add tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9"
6
+ insert_into_file "#{Webpacker.config.source_entry_path}/application.js", "\nimport \"stylesheets/application\"\n"
8
7
 
9
- say "Adding latest Tailwind CSS and postCSS"
10
- run "yarn add tailwindcss@latest postcss@latest autoprefixer@latest"
11
- insert_into_file "#{Webpacker.config.source_entry_path}/application.js", "\nrequire(\"stylesheets/application.scss\")\n"
12
-
13
- say "Adding minimal configuration for Tailwind CSS to work properly"
8
+ say "Configuring Tailwind CSS"
14
9
  directory Pathname.new(__dir__).join("stylesheets"), Webpacker.config.source_path.join("stylesheets")
10
+ Dir.chdir(WEBPACK_STYLESHEETS_PATH) { run "npx tailwindcss init" }
11
+
12
+ insert_into_file "postcss.config.js", "require('tailwindcss')(\"./app/javascript/stylesheets/tailwind.config.js\"),\n ",
13
+ before: "require('postcss-import')"
15
14
 
16
- insert_into_file "postcss.config.js", "require('tailwindcss'),\n\t", before: " require('postcss-import')"
17
15
 
18
16
  if APPLICATION_LAYOUT_PATH.exist?
19
17
  say "Add Tailwindcss include tags in application layout"
@@ -1,5 +1,5 @@
1
1
  class Tailwindcss::Purger
2
- CLASS_NAME_PATTERN = /([:A-Za-z0-9_-]+[\.]*[\\\/:A-Za-z0-9_-]*)/
2
+ CLASS_NAME_PATTERN = /([:A-Za-z0-9_-]+[\.\\\/:A-Za-z0-9_-]*)/
3
3
  OPENING_SELECTOR_PATTERN = /\..*\{/
4
4
  CLOSING_SELECTOR_PATTERN = /\s*\}/
5
5
  NEWLINE = "\n"
@@ -1,3 +1,3 @@
1
1
  module Tailwindcss
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.3"
3
3
  end
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.3.1
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-22 00:00:00.000000000 Z
11
+ date: 2021-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,7 +24,7 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 6.0.0
27
- description:
27
+ description:
28
28
  email: david@loudthinking.com
29
29
  executables: []
30
30
  extensions: []
@@ -65,7 +65,7 @@ licenses:
65
65
  - MIT
66
66
  metadata:
67
67
  homepage_uri: https://github.com/rails/tailwindcss-rails
68
- post_install_message:
68
+ post_install_message:
69
69
  rdoc_options: []
70
70
  require_paths:
71
71
  - lib
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  version: '0'
82
82
  requirements: []
83
83
  rubygems_version: 3.1.2
84
- signing_key:
84
+ signing_key:
85
85
  specification_version: 4
86
86
  summary: Integrate Tailwind CSS with the asset pipeline in Rails.
87
87
  test_files: []