jekyll-tailwind 2.0 → 2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +8 -6
- data/lib/jekyll-tailwind/version.rb +1 -1
- data/lib/jekyll-tailwind.rb +11 -20
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfc5db87c31c4f1f704558198c29a61878e9d3bfc707d8a448ca63b166487a29
|
4
|
+
data.tar.gz: 3f2472d57d40f82f51e3de00517d58bff5fe4e5a6f04d22aef4cc0934b5abb6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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
|
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
|
data/lib/jekyll-tailwind.rb
CHANGED
@@ -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
|
-
|
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
|
-
@
|
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.
|
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:
|
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.
|
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
|