jekyll-tailwind 2.0 → 2.1.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: 4143a6e5cdedea6635ca46b69cee1add21aacab556875ab7b3846f4ea9df026d
4
+ data.tar.gz: 47e54243b19a5ac892cc08cef4a823aa4a6c420d07f92d0388268a68f739e897
5
5
  SHA512:
6
- metadata.gz: 6200779f8f62198a024eccdef38d4b00049e4038cc11faa9085ead0eddcc70dd1140473808ea740e7b7153cbfdf83794721e032b24c9343d1322664d0466407e
7
- data.tar.gz: 7b0f26e3787c3396bf501c6e9ca2cd856da9821c9d865a52550de9e1d2d92c42c303f3b3057ab9d35f2ac40138b46c966a925c5edc93ff27862cd51b07a67c79
6
+ metadata.gz: d34b4390d3366fd5ead345389af9a5bfba1475efdbdd3f317059c400368b5c1bf8c8e17d6ff94b99d1ed7cae26ee9f0fc41be2b8880a21860198a13a7260f9de
7
+ data.tar.gz: e25623e155c247490e433a28e12a3915fe64b23556136ad09a520ac5b53f260c88571b2d5fccec539c447b63c83afd3e02172023b9227c00c96707fd2e4f61f1
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.1"
6
6
  end
7
7
  end
@@ -2,12 +2,12 @@
2
2
 
3
3
  require_relative "jekyll-tailwind/version"
4
4
 
5
+ require "shellwords"
5
6
  require "jekyll"
6
7
  require "tailwindcss/ruby"
7
8
 
8
9
  module Jekyll
9
10
  class Tailwind
10
-
11
11
  def initialize(config)
12
12
  if config["config_path"]
13
13
  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,44 +18,36 @@ module Jekyll
18
18
 
19
19
  @config = config["config_path"] || config["config"] || "tailwind.config.js"
20
20
  @postcss = config.fetch("postcss", "postcss.config.js")
21
- @inputs = Array.wrap(config["input"])
21
+
22
+ @input = if config["input"].is_a?(Array)
23
+ 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`"
24
+
25
+ raise "Multiple input files are not supported" if config["input"].length > 1
26
+
27
+ config["input"].first
28
+ else
29
+ config["input"]
30
+ end
22
31
  @output = config.fetch("output", "_site/assets/css/app.css")
23
32
  @minify = config.fetch("minify", false)
24
33
  end
25
34
 
26
35
  def compile
27
36
  command = [
28
- Tailwindcss::Ruby.executable,
29
- "--output", @output,
30
- "--config", @config,
37
+ Shellwords.escape(Tailwindcss::Ruby.executable),
38
+ "--output", @output.shellescape,
39
+ "--config", @config.shellescape,
31
40
  ]
32
41
 
33
- @inputs.each do |input|
34
- # There could be multiple input files or non at all.
35
- command += ["--input", input]
36
- end
37
-
42
+ command += ["--input", @input.shellescape] if @input
38
43
  command += ["--minify"] if @minify
39
- command += ["--postcss", @postcss] if File.exist?(@postcss)
44
+ command += ["--postcss", @postcss.shellescape] if File.exist?(@postcss)
40
45
 
41
46
  `#{command.join(' ')}`
42
47
  end
43
48
  end
44
49
  end
45
50
 
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
51
  # 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
52
  Jekyll::Hooks.register [:site], :post_write do |site|
61
53
  Jekyll::Tailwind.new(site.config.fetch('tailwind', {})).compile
metadata CHANGED
@@ -1,15 +1,14 @@
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cristian Álvarez Belaustegui
8
8
  - Stanislav (Stas) Katkov
9
- autorequire:
10
9
  bindir: exe
11
10
  cert_chain: []
12
- date: 2024-09-30 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: jekyll
@@ -81,7 +80,6 @@ metadata:
81
80
  homepage_uri: https://github.com/crbelaus/jekyll-tailwind
82
81
  source_code_uri: https://github.com/crbelaus/jekyll-tailwind
83
82
  changelog_uri: https://github.com/crbelaus/jekyll-tailwind/blob/main/CHANGELOG.md
84
- post_install_message:
85
83
  rdoc_options: []
86
84
  require_paths:
87
85
  - lib
@@ -96,8 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
94
  - !ruby/object:Gem::Version
97
95
  version: '0'
98
96
  requirements: []
99
- rubygems_version: 3.5.18
100
- signing_key:
97
+ rubygems_version: 4.0.19
101
98
  specification_version: 4
102
99
  summary: Use Tailwind CLI from your Jekyll site
103
100
  test_files: []