jekyll-tailwind 2.0 → 2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d82dc9fc27d2610ab179921fb207767cb26503eac4f31c6d2267d9511b3f22fa
4
- data.tar.gz: 9aa5f5960cdc007c4825a8dd9bc6f99c39292754bb528395a248dad292e9e404
3
+ metadata.gz: bfc5db87c31c4f1f704558198c29a61878e9d3bfc707d8a448ca63b166487a29
4
+ data.tar.gz: 3f2472d57d40f82f51e3de00517d58bff5fe4e5a6f04d22aef4cc0934b5abb6b
5
5
  SHA512:
6
- metadata.gz: 6200779f8f62198a024eccdef38d4b00049e4038cc11faa9085ead0eddcc70dd1140473808ea740e7b7153cbfdf83794721e032b24c9343d1322664d0466407e
7
- data.tar.gz: 7b0f26e3787c3396bf501c6e9ca2cd856da9821c9d865a52550de9e1d2d92c42c303f3b3057ab9d35f2ac40138b46c966a925c5edc93ff27862cd51b07a67c79
6
+ metadata.gz: 7c17b0881fb9ca7878c97e9619243ea7f4b1742e9342e414ddacb02a3ae0b5a8a29c9392372a97a515d39c17e72fca1416263698e2f4f95f583a500378586b31
7
+ data.tar.gz: 10c55df1672307e2b27c177c466e2155a4b8d4be3233fc6ef9d6ca35605312e0c700197fc0c89fbadcfaa4cb13635252e027490393b8cf01dbb2834698c51207
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## Unreleased
2
+
3
+ ## [2.1.0] - 2025-01-20
4
+ ### Changed
5
+ - We emit a deprecation warning if Arrays is used for input config.
6
+
7
+ ### Added
8
+ - Fail a build, if there are multiple input files defined.
9
+
1
10
  ## [2.0.0] - 2024-09-30
2
11
  ### New
3
12
  - Use tailwindcss-ruby gem as a wrapper for executable.
data/README.md CHANGED
@@ -12,8 +12,13 @@ group :jekyll_plugins do
12
12
  gem 'jekyll-tailwind'
13
13
  end
14
14
  ```
15
+ 2. Add plugin to _config.yml:
16
+ ```yml
17
+ plugins:
18
+ - jekyll-tailwind
19
+ ```
15
20
 
16
- 2. Add **tailwind.config.js** to root directory with following contents
21
+ 3. Add **tailwind.config.js** to root directory with following contents
17
22
  ```js
18
23
  module.exports = {
19
24
  content: ["./**/*.html"],
@@ -28,12 +33,9 @@ module.exports = {
28
33
  };
29
34
  ```
30
35
 
31
- 3. Modify default template to include app.css, e.g.:
36
+ 4. Modify default template to include app.css, e.g.:
32
37
  `<link rel="stylesheet" href="{{ "/assets/css/app.css" | relative_url }}">`
33
38
 
34
- **The first time you build your Jekyll site, this gem will automatically download the Tailwind CLI for your platform and use it to build your CSS.** The Tailwind CLI will be saved in `_tailwind/tailwind-VERSION-PLATFORM`. It is recommended that you add this file to your `.gitignore` and don't commit it to your repository.
35
-
36
- It is important to note that **subsequent runs will use the existing Tailwind CLI and won't download it again.**
37
39
 
38
40
  ## Adjust tailwind configuration
39
41
 
@@ -47,7 +49,7 @@ But it's possible to tweak these settings through `_config.yml` file:
47
49
  ```yml
48
50
  tailwind:
49
51
  config: config/tailwind.config.js
50
- input: assets/css/app.css # or [assets/css/app.css, assets/css/web.css]
52
+ input: assets/css/app.css
51
53
  output: _site/assets/css/web.css
52
54
  postcss: config/postcss.config.js # default is nil
53
55
  minify: true # defaults to false
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  class Tailwind
5
- VERSION = "2.0"
5
+ VERSION = "2.1"
6
6
  end
7
7
  end
@@ -7,7 +7,6 @@ require "tailwindcss/ruby"
7
7
 
8
8
  module Jekyll
9
9
  class Tailwind
10
-
11
10
  def initialize(config)
12
11
  if config["config_path"]
13
12
  Jekyll.logger.warn "WARNING: The `config_path` option is deprecated and will be removed in the next releases. Please use the `config` option instead."
@@ -18,7 +17,16 @@ module Jekyll
18
17
 
19
18
  @config = config["config_path"] || config["config"] || "tailwind.config.js"
20
19
  @postcss = config.fetch("postcss", "postcss.config.js")
21
- @inputs = Array.wrap(config["input"])
20
+
21
+ @input = if config["input"].is_a?(Array)
22
+ Jekyll.logger.warn "DEPRECATION: jekyll-tailwind gem can't have multiple input files. Ability to provide array as input will be gradually fazed out. Change array value like this `[assets/css/app.css]` to `assets/css/app.css`"
23
+
24
+ raise "Multiple input files are not supported" if config["input"].length > 1
25
+
26
+ config["input"].first
27
+ else
28
+ config["input"]
29
+ end
22
30
  @output = config.fetch("output", "_site/assets/css/app.css")
23
31
  @minify = config.fetch("minify", false)
24
32
  end
@@ -30,11 +38,7 @@ module Jekyll
30
38
  "--config", @config,
31
39
  ]
32
40
 
33
- @inputs.each do |input|
34
- # There could be multiple input files or non at all.
35
- command += ["--input", input]
36
- end
37
-
41
+ command += ["--input", @input] if @input
38
42
  command += ["--minify"] if @minify
39
43
  command += ["--postcss", @postcss] if File.exist?(@postcss)
40
44
 
@@ -43,19 +47,6 @@ module Jekyll
43
47
  end
44
48
  end
45
49
 
46
- class Array
47
- # Taken from rails/activesupport/lib/active_support/core_ext/array/wrap.rb
48
- def self.wrap(object)
49
- if object.nil?
50
- []
51
- elsif object.respond_to?(:to_ary)
52
- object.to_ary || [object]
53
- else
54
- [object]
55
- end
56
- end
57
- end
58
-
59
50
  # It's important to run TailwindCSS compilation after Jekyll has finished with build steps. TailwindCSS will analyse resulting HTML and produce a CSS file with attributes that are actually in use, this is done to produce a smaller CSS file.
60
51
  Jekyll::Hooks.register [:site], :post_write do |site|
61
52
  Jekyll::Tailwind.new(site.config.fetch('tailwind', {})).compile
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-tailwind
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.0'
4
+ version: '2.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cristian Álvarez Belaustegui
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-09-30 00:00:00.000000000 Z
12
+ date: 2025-01-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jekyll
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  requirements: []
99
- rubygems_version: 3.5.18
99
+ rubygems_version: 3.5.22
100
100
  signing_key:
101
101
  specification_version: 4
102
102
  summary: Use Tailwind CLI from your Jekyll site