jekyll-tailwindcss 0.3.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -17
- data/lib/jekyll/converters/tailwindcss.rb +7 -1
- data/lib/jekyll-tailwindcss/version.rb +1 -1
- data/lib/jekyll-tailwindcss.rb +0 -1
- data/lib/tailwindcss/commands.rb +5 -75
- data/lib/tailwindcss/upstream.rb +2 -12
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9492cf16b8cad5f3df51dcfdd261be6be8e32924607dc589d0edeae0bc6f13da
|
4
|
+
data.tar.gz: d3937dbfa2fa5fd19cd1fbe6054228496c2534607c3944e7eb3216e6815c73cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0f7f4ab399b48b20094fd93ef318f4601c30e24547b7e2154720d1c5f1a34efe8c693dc9087babcafdd428f0d1017200a85c376527ea64a0d6ba4d7dcc995c5
|
7
|
+
data.tar.gz: cd1594db42c22df32a69da50557fc767c01bb4ce21f9c1f0755ab120bf29c0bc7cc38286996b5b6dcd9077f82aa0da1883301457559fb039dda462dcd71fb261
|
data/README.md
CHANGED
@@ -4,8 +4,6 @@ Bring the fun of building with TailwindCSS into your Jekyll project (without any
|
|
4
4
|
|
5
5
|
**TL;DR** This gem borrows *heavily* from [tailwindcss-rails](https://github.com/rails/tailwindcss-rails) to provide platform-specific tailwind executables and provide a smooth developer experience in Jekyll projects
|
6
6
|
|
7
|
-
Much like the Rails gem, this gem wraps [the standalone executable version](https://tailwindcss.com/blog/standalone-cli) of the Tailwind CSS v3 framework. It installs these as platform-specific executables, so there are separate underlying gems per platform, but the correct gem will automatically be picked for your platform.
|
8
|
-
|
9
7
|
> “Because building a great jekyll site shouldn’t require a `node_modules` folder
|
10
8
|
|
11
9
|
## Installation
|
@@ -58,6 +56,15 @@ Any `*.css` file processed by jekyll [^1] that contains the `@tailwind` [directi
|
|
58
56
|
|
59
57
|
[^1]: Jekyll will process any file that begins with yaml [frontmatter](https://jekyllrb.com/docs/front-matter/)
|
60
58
|
|
59
|
+
### Configuration
|
60
|
+
|
61
|
+
Location of the `tailwind.config.js` file can be configured in `_config.yml`:
|
62
|
+
|
63
|
+
``` yaml
|
64
|
+
tailwindcss:
|
65
|
+
config: './tailwind.config.js' # this is the default location
|
66
|
+
```
|
67
|
+
|
61
68
|
### Examples
|
62
69
|
|
63
70
|
|
@@ -91,26 +98,16 @@ will be converted to
|
|
91
98
|
|
92
99
|
## Development
|
93
100
|
|
94
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
|
101
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
|
95
102
|
|
96
103
|
To install this gem on your local machine, run `bundle exec rake install`.
|
97
104
|
|
98
|
-
### Updating to the latest upstream tailwindcss version
|
99
|
-
|
100
|
-
Update `lib/tailwindcss/upstream.rb` with the upstream version.
|
101
|
-
|
102
|
-
Run `bundle exec rake clobber` and then `bundle exec rake download` to ensure the tailwindcss binaries can be downloaded and you have the correct versions on the local disk.
|
103
|
-
|
104
|
-
|
105
105
|
## Testing this gem
|
106
106
|
|
107
107
|
### Running the test suite
|
108
108
|
|
109
109
|
The unit tests are run with `bundle exec rspec`
|
110
110
|
|
111
|
-
There is an additional integration test which runs in CI, `spec/integration/user_journey_test.sh` which you may also want to run.
|
112
|
-
|
113
|
-
|
114
111
|
### Testing in a Jekyll project
|
115
112
|
|
116
113
|
If you want to test modifications to this gem, you must run `rake download` once to download the upstream `tailwindcss` executables.
|
@@ -127,11 +124,9 @@ gem "jekyll-tailwindcss", path: "/path/to/jekyll-tailwindcss"
|
|
127
124
|
- [ ] update `lib/jekyll-tailwindcss/version.rb`
|
128
125
|
- [ ] update `CHANGELOG.md`
|
129
126
|
- [ ] commit and create a git tag ( example `git tag -a v0.3.1 -m "Release 0.3.1"` )
|
130
|
-
- build the native gems:
|
131
|
-
- [ ] `bundle exec rake clobber` to clean up possibly old tailwindcss executables
|
132
|
-
- [ ] `bundle exec rake package`
|
133
127
|
- push
|
134
|
-
- [ ] `
|
128
|
+
- [ ] `bundle exec rake build`
|
129
|
+
- [ ] `gem push pkg/*.gem`
|
135
130
|
- [ ] `git push --follow-tags`
|
136
131
|
- announce
|
137
132
|
- [ ] create a release at https://github.com/vormwald/jekyll-tailwindcss/releases
|
@@ -21,7 +21,9 @@ module Jekyll
|
|
21
21
|
dev_mode = Jekyll.env == "development"
|
22
22
|
Jekyll.logger.info "Jekyll Tailwind:", "Generating #{dev_mode ? "" : "minified "}CSS"
|
23
23
|
|
24
|
-
compile_command = ::Tailwindcss::Commands
|
24
|
+
compile_command = ::Tailwindcss::Commands
|
25
|
+
.compile_command(debug: dev_mode, config: config_location)
|
26
|
+
.join(" ")
|
25
27
|
|
26
28
|
output, error = nil
|
27
29
|
Open3.popen3(tailwindcss_env_options, compile_command) do |stdin, stdout, stderr, _wait_thread|
|
@@ -45,6 +47,10 @@ module Jekyll
|
|
45
47
|
# Since we're using the CLI, we can't update the data, so we ignore it.
|
46
48
|
{"BROWSERSLIST_IGNORE_OLD_DATA" => "1"}
|
47
49
|
end
|
50
|
+
|
51
|
+
def config_location
|
52
|
+
@config.dig("tailwindcss", "config") || "./tailwind.config.js"
|
53
|
+
end
|
48
54
|
end
|
49
55
|
end
|
50
56
|
end
|
data/lib/jekyll-tailwindcss.rb
CHANGED
data/lib/tailwindcss/commands.rb
CHANGED
@@ -1,84 +1,14 @@
|
|
1
|
-
|
1
|
+
require "tailwindcss/ruby"
|
2
2
|
|
3
3
|
module Tailwindcss
|
4
4
|
module Commands
|
5
|
-
DEFAULT_DIR = File.expand_path(File.join(__dir__, "..", "..", "exe"))
|
6
|
-
GEM_NAME = "jekyll-tailwindcss"
|
7
|
-
|
8
|
-
# raised when the host platform is not supported by upstream tailwindcss's binary releases
|
9
|
-
class UnsupportedPlatformException < StandardError
|
10
|
-
end
|
11
|
-
|
12
|
-
# raised when the tailwindcss executable could not be found where we expected it to be
|
13
|
-
class ExecutableNotFoundException < StandardError
|
14
|
-
end
|
15
|
-
|
16
|
-
# raised when TAILWINDCSS_INSTALL_DIR does not exist
|
17
|
-
class DirectoryNotFoundException < StandardError
|
18
|
-
end
|
19
|
-
|
20
5
|
class << self
|
21
|
-
def
|
22
|
-
[:cpu, :os].map { |m| Gem::Platform.local.send(m) }.join("-")
|
23
|
-
end
|
24
|
-
|
25
|
-
def executable(exe_path: DEFAULT_DIR)
|
26
|
-
tailwindcss_install_dir = ENV["TAILWINDCSS_INSTALL_DIR"]
|
27
|
-
if tailwindcss_install_dir
|
28
|
-
if File.directory?(tailwindcss_install_dir)
|
29
|
-
warn "NOTE: using TAILWINDCSS_INSTALL_DIR to find tailwindcss executable: #{tailwindcss_install_dir}"
|
30
|
-
exe_path = tailwindcss_install_dir
|
31
|
-
exe_file = File.expand_path(File.join(tailwindcss_install_dir, "tailwindcss"))
|
32
|
-
else
|
33
|
-
raise DirectoryNotFoundException, <<~MESSAGE
|
34
|
-
TAILWINDCSS_INSTALL_DIR is set to #{tailwindcss_install_dir}, but that directory does not exist.
|
35
|
-
MESSAGE
|
36
|
-
end
|
37
|
-
else
|
38
|
-
if Tailwindcss::Upstream::NATIVE_PLATFORMS.keys.none? { |p| Gem::Platform.match_gem?(Gem::Platform.new(p), GEM_NAME) }
|
39
|
-
raise UnsupportedPlatformException, <<~MESSAGE
|
40
|
-
jekyll-tailwindcss does not support the #{platform} platform
|
41
|
-
Please install tailwindcss following instructions at https://tailwindcss.com/docs/installation
|
42
|
-
MESSAGE
|
43
|
-
end
|
44
|
-
|
45
|
-
exe_file = Dir.glob(File.expand_path(File.join(exe_path, "*", "tailwindcss"))).find do |f|
|
46
|
-
Gem::Platform.match_gem?(Gem::Platform.new(File.basename(File.dirname(f))), GEM_NAME)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
if exe_file.nil? || !File.exist?(exe_file)
|
51
|
-
raise ExecutableNotFoundException, <<~MESSAGE
|
52
|
-
Cannot find the tailwindcss executable for #{platform} in #{exe_path}
|
53
|
-
|
54
|
-
If you're using bundler, please make sure you're on the latest bundler version:
|
55
|
-
|
56
|
-
gem install bundler
|
57
|
-
bundle update --bundler
|
58
|
-
|
59
|
-
Then make sure your lock file includes this platform by running:
|
60
|
-
|
61
|
-
bundle lock --add-platform #{platform}
|
62
|
-
bundle install
|
63
|
-
|
64
|
-
See `bundle lock --help` output for details.
|
65
|
-
|
66
|
-
TODO If you're still seeing this message after taking those steps, try running
|
67
|
-
`bundle config` and ensure `force_ruby_platform` isn't set to `true`. See
|
68
|
-
https://github.com/vormwald/jekyll-tailwindcss#check-bundle_force_ruby_platform
|
69
|
-
for more details.
|
70
|
-
MESSAGE
|
71
|
-
end
|
72
|
-
|
73
|
-
exe_file
|
74
|
-
end
|
75
|
-
|
76
|
-
def compile_command(debug: false, **kwargs)
|
6
|
+
def compile_command(debug: false, config: nil, **kwargs)
|
77
7
|
command = [
|
78
|
-
executable(**kwargs),
|
79
|
-
"--input", "-"
|
80
|
-
"--config", "./tailwind.config.js"
|
8
|
+
Tailwindcss::Ruby.executable(**kwargs),
|
9
|
+
"--input", "-"
|
81
10
|
]
|
11
|
+
command += ["--config", config] if config
|
82
12
|
|
83
13
|
command << "--minify" unless debug
|
84
14
|
|
data/lib/tailwindcss/upstream.rb
CHANGED
@@ -1,17 +1,7 @@
|
|
1
1
|
module Tailwindcss
|
2
2
|
# constants describing the upstream tailwindcss project
|
3
3
|
module Upstream
|
4
|
-
VERSION =
|
5
|
-
|
6
|
-
# rubygems platform name => upstream release filename
|
7
|
-
NATIVE_PLATFORMS = {
|
8
|
-
"arm64-darwin" => "tailwindcss-macos-arm64",
|
9
|
-
"x64-mingw32" => "tailwindcss-windows-x64.exe",
|
10
|
-
"x64-mingw-ucrt" => "tailwindcss-windows-x64.exe",
|
11
|
-
"x86_64-darwin" => "tailwindcss-macos-x64",
|
12
|
-
"x86_64-linux" => "tailwindcss-linux-x64",
|
13
|
-
"aarch64-linux" => "tailwindcss-linux-arm64",
|
14
|
-
"arm-linux" => "tailwindcss-linux-armv7"
|
15
|
-
}
|
4
|
+
VERSION = Tailwindcss::Ruby::Upstream::VERSION
|
5
|
+
deprecate_constant :VERSION
|
16
6
|
end
|
17
7
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-tailwindcss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Vormwald
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
12
|
-
dependencies:
|
11
|
+
date: 2024-12-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: tailwindcss-ruby
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
description:
|
14
28
|
email:
|
15
29
|
- mvormwald@gmail.com
|
@@ -40,14 +54,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
40
54
|
requirements:
|
41
55
|
- - ">="
|
42
56
|
- !ruby/object:Gem::Version
|
43
|
-
version: 3.
|
57
|
+
version: 3.1.0
|
44
58
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
59
|
requirements:
|
46
60
|
- - ">="
|
47
61
|
- !ruby/object:Gem::Version
|
48
62
|
version: '0'
|
49
63
|
requirements: []
|
50
|
-
rubygems_version: 3.5.
|
64
|
+
rubygems_version: 3.5.11
|
51
65
|
signing_key:
|
52
66
|
specification_version: 4
|
53
67
|
summary: Integrate Tailwind CSS into your Jekyll site.
|