jekyll-tailwind 1.0.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 +4 -4
- data/CHANGELOG.md +22 -1
- data/README.md +43 -13
- data/Rakefile +1 -0
- data/lib/jekyll-tailwind/version.rb +1 -1
- data/lib/jekyll-tailwind.rb +45 -6
- metadata +35 -6
- data/jekyll-tailwind.gemspec +0 -37
- data/lib/jekyll-tailwind/installer.rb +0 -47
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,4 +1,25 @@
|
|
1
|
-
##
|
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
|
+
|
10
|
+
## [2.0.0] - 2024-09-30
|
11
|
+
### New
|
12
|
+
- Use tailwindcss-ruby gem as a wrapper for executable.
|
13
|
+
- Expose `input` and `output` parameters in _config.yml.
|
14
|
+
- It's possible to minimize output now
|
15
|
+
- support for postcss was added.
|
16
|
+
- `rake` was added as a dev dependency, to publish updates with `rake release`.
|
17
|
+
|
18
|
+
### Changed
|
19
|
+
- `config_path` is currently deprecated and will be replaced with `config`
|
20
|
+
|
21
|
+
### Removed
|
22
|
+
- `version` setting doesn't do anything anymore, tailwindcss executable version could be managed through Gemfile.
|
2
23
|
|
3
24
|
## [1.0.0] - 2024-03-13
|
4
25
|
|
data/README.md
CHANGED
@@ -6,34 +6,64 @@
|
|
6
6
|
|
7
7
|
To add this gem to your project you must include it in your Gemfile:
|
8
8
|
|
9
|
+
1. Add a gem
|
9
10
|
```ruby
|
10
11
|
group :jekyll_plugins do
|
11
12
|
gem 'jekyll-tailwind'
|
12
13
|
end
|
13
14
|
```
|
15
|
+
2. Add plugin to _config.yml:
|
16
|
+
```yml
|
17
|
+
plugins:
|
18
|
+
- jekyll-tailwind
|
19
|
+
```
|
20
|
+
|
21
|
+
3. Add **tailwind.config.js** to root directory with following contents
|
22
|
+
```js
|
23
|
+
module.exports = {
|
24
|
+
content: ["./**/*.html"],
|
25
|
+
theme: {
|
26
|
+
extend: {},
|
27
|
+
},
|
28
|
+
plugins: [
|
29
|
+
require('@tailwindcss/typography'),
|
30
|
+
require('@tailwindcss/forms'),
|
31
|
+
require('@tailwindcss/container-queries')
|
32
|
+
],
|
33
|
+
};
|
34
|
+
```
|
35
|
+
|
36
|
+
4. Modify default template to include app.css, e.g.:
|
37
|
+
`<link rel="stylesheet" href="{{ "/assets/css/app.css" | relative_url }}">`
|
14
38
|
|
15
|
-
**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.
|
16
39
|
|
17
|
-
|
40
|
+
## Adjust tailwind configuration
|
18
41
|
|
19
|
-
|
42
|
+
By default Tailwind will:
|
43
|
+
- read the `tailwind.config.js` file that lives in your project's root (more info at [the Tailwind docs](https://tailwindcss.com/docs/configuration)).
|
44
|
+
- Output file will also be written into `_site/assets/css/app.css`.
|
45
|
+
- Process postcss if `postcss.config.js` is present in the root directory.
|
20
46
|
|
21
|
-
|
47
|
+
But it's possible to tweak these settings through `_config.yml` file:
|
22
48
|
|
23
49
|
```yml
|
24
50
|
tailwind:
|
25
|
-
|
51
|
+
config: config/tailwind.config.js
|
52
|
+
input: assets/css/app.css
|
53
|
+
output: _site/assets/css/web.css
|
54
|
+
postcss: config/postcss.config.js # default is nil
|
55
|
+
minify: true # defaults to false
|
26
56
|
```
|
27
57
|
|
28
|
-
|
58
|
+
## Picking Tailwind version
|
59
|
+
It's possible to pick particular version of tailwindd by locking `tailwindcss-ruby` dependency to certain version. Add following to your Gemfile:
|
29
60
|
|
30
|
-
|
61
|
+
`gem 'tailwindcss-ruby', '>=3', '<4'`
|
31
62
|
|
32
|
-
|
63
|
+
or if you're looking for a 4v:
|
33
64
|
|
34
|
-
|
65
|
+
`gem 'tailwindcss-ruby', '>=4'`
|
35
66
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
```
|
67
|
+
|
68
|
+
## Troubleshooting
|
69
|
+
You may run into issues with tailwind executable, please refer to [troubleshooting section in tailwindcss-ruby gem](https://github.com/flavorjones/tailwindcss-ruby?tab=readme-ov-file#troubleshooting).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/jekyll-tailwind.rb
CHANGED
@@ -1,14 +1,53 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "jekyll-tailwind/version"
|
4
|
-
require_relative "jekyll-tailwind/installer"
|
5
4
|
|
6
5
|
require "jekyll"
|
6
|
+
require "tailwindcss/ruby"
|
7
7
|
|
8
|
+
module Jekyll
|
9
|
+
class Tailwind
|
10
|
+
def initialize(config)
|
11
|
+
if config["config_path"]
|
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."
|
13
|
+
end
|
14
|
+
if config["version"]
|
15
|
+
Jekyll.logger.warn "WARNING: The `version` option has no effect, version could be managed through 'tailwindcss-ruby' gem in you're Gemfile."
|
16
|
+
end
|
17
|
+
|
18
|
+
@config = config["config_path"] || config["config"] || "tailwind.config.js"
|
19
|
+
@postcss = config.fetch("postcss", "postcss.config.js")
|
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
|
30
|
+
@output = config.fetch("output", "_site/assets/css/app.css")
|
31
|
+
@minify = config.fetch("minify", false)
|
32
|
+
end
|
33
|
+
|
34
|
+
def compile
|
35
|
+
command = [
|
36
|
+
Tailwindcss::Ruby.executable,
|
37
|
+
"--output", @output,
|
38
|
+
"--config", @config,
|
39
|
+
]
|
40
|
+
|
41
|
+
command += ["--input", @input] if @input
|
42
|
+
command += ["--minify"] if @minify
|
43
|
+
command += ["--postcss", @postcss] if File.exist?(@postcss)
|
44
|
+
|
45
|
+
`#{command.join(' ')}`
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
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.
|
8
51
|
Jekyll::Hooks.register [:site], :post_write do |site|
|
9
|
-
|
10
|
-
version: site.config.dig("tailwind", "version"),
|
11
|
-
config_path: site.config.dig("tailwind", "config_path")
|
12
|
-
)
|
13
|
-
tailwind.install_and_run
|
52
|
+
Jekyll::Tailwind.new(site.config.fetch('tailwind', {})).compile
|
14
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-tailwind
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1
|
4
|
+
version: '2.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Cristian Álvarez Belaustegui
|
8
|
+
- Stanislav (Stas) Katkov
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2025-01-20 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: jekyll
|
@@ -30,9 +31,38 @@ dependencies:
|
|
30
31
|
- - "<"
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '5.0'
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: tailwindcss-ruby
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
type: :runtime
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rake
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
33
62
|
description: Run TailwindCSS from your Jekyll site without requiring NodeJS
|
34
63
|
email:
|
35
64
|
- cristian@crbelaus.com
|
65
|
+
- github@skatkov.com
|
36
66
|
executables: []
|
37
67
|
extensions: []
|
38
68
|
extra_rdoc_files: []
|
@@ -41,9 +71,8 @@ files:
|
|
41
71
|
- CHANGELOG.md
|
42
72
|
- LICENSE.txt
|
43
73
|
- README.md
|
44
|
-
-
|
74
|
+
- Rakefile
|
45
75
|
- lib/jekyll-tailwind.rb
|
46
|
-
- lib/jekyll-tailwind/installer.rb
|
47
76
|
- lib/jekyll-tailwind/version.rb
|
48
77
|
homepage: https://github.com/crbelaus/jekyll-tailwind
|
49
78
|
licenses:
|
@@ -67,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
96
|
- !ruby/object:Gem::Version
|
68
97
|
version: '0'
|
69
98
|
requirements: []
|
70
|
-
rubygems_version: 3.5.
|
99
|
+
rubygems_version: 3.5.22
|
71
100
|
signing_key:
|
72
101
|
specification_version: 4
|
73
102
|
summary: Use Tailwind CLI from your Jekyll site
|
data/jekyll-tailwind.gemspec
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "lib/jekyll-tailwind/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "jekyll-tailwind"
|
7
|
-
spec.version = Jekyll::Tailwind::VERSION
|
8
|
-
spec.authors = ["crbelaus"]
|
9
|
-
spec.email = ["cristian@crbelaus.com"]
|
10
|
-
|
11
|
-
spec.summary = "Use Tailwind CLI from your Jekyll site"
|
12
|
-
spec.description = "Run TailwindCSS from your Jekyll site without requiring NodeJS"
|
13
|
-
spec.homepage = "https://github.com/crbelaus/jekyll-tailwind"
|
14
|
-
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = ">= 2.6.0"
|
16
|
-
|
17
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
-
spec.metadata["source_code_uri"] = "https://github.com/crbelaus/jekyll-tailwind"
|
19
|
-
spec.metadata["changelog_uri"] = "https://github.com/crbelaus/jekyll-tailwind/blob/main/CHANGELOG.md"
|
20
|
-
|
21
|
-
# Specify which files should be added to the gem when it is released.
|
22
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
-
spec.files = Dir.chdir(__dir__) do
|
24
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
25
|
-
(File.expand_path(f) == __FILE__) ||
|
26
|
-
f.start_with?(*%w[bin/ test/ spec/ features/ .git appveyor Gemfile])
|
27
|
-
end
|
28
|
-
end
|
29
|
-
spec.bindir = "exe"
|
30
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
31
|
-
spec.require_paths = ["lib"]
|
32
|
-
|
33
|
-
spec.add_dependency "jekyll", ">= 3.0", "< 5.0"
|
34
|
-
|
35
|
-
# For more information and examples about making a new gem, check out our
|
36
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
37
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "fileutils"
|
4
|
-
require "jekyll"
|
5
|
-
require "open-uri"
|
6
|
-
|
7
|
-
module Jekyll
|
8
|
-
class Tailwind::Installer
|
9
|
-
def initialize(options)
|
10
|
-
@target =
|
11
|
-
case RUBY_PLATFORM
|
12
|
-
when "arm64-darwin23"
|
13
|
-
"macos-arm64"
|
14
|
-
when "x86_64-linux"
|
15
|
-
"linux-x64"
|
16
|
-
else
|
17
|
-
raise "Tailwind CLI is not available for platform: #{RUBY_PLATFORM}"
|
18
|
-
end
|
19
|
-
|
20
|
-
@version = options[:version] || "3.4.1"
|
21
|
-
@config_path = options[:config_path] || "tailwind.config.js"
|
22
|
-
@path = "_tailwind/tailwind-#{@target}-#{@version}"
|
23
|
-
end
|
24
|
-
|
25
|
-
def install_and_run
|
26
|
-
install unless File.exist?(@path)
|
27
|
-
|
28
|
-
`#{@path} -i _site/assets/css/app.css -o _site/assets/css/app.css -c #{@config_path}`
|
29
|
-
Jekyll.logger.info "Tailwind:", "Rebuilt _site/assets/css/app.css"
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def install
|
35
|
-
Jekyll.logger.info "Tailwind:", "CLI version #{@version} not found for #{@target}"
|
36
|
-
Jekyll.logger.info "Tailwind:", "Installing..."
|
37
|
-
|
38
|
-
uri = URI.parse("https://github.com/tailwindlabs/tailwindcss/releases/download/v#{@version}/tailwindcss-#{@target}")
|
39
|
-
file = uri.open
|
40
|
-
|
41
|
-
FileUtils.mkdir "_tailwind" unless File.exist?("_tailwind")
|
42
|
-
FileUtils.install file.path, @path, mode: 0o755
|
43
|
-
|
44
|
-
Jekyll.logger.info "Tailwind:", "CLI installed at #{@path}"
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|