jekyll-tailwind 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.standard.yml +3 -0
- data/CHANGELOG.md +8 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/jekyll-tailwind.gemspec +37 -0
- data/lib/jekyll-tailwind/installer.rb +47 -0
- data/lib/jekyll-tailwind/version.rb +7 -0
- data/lib/jekyll-tailwind.rb +14 -0
- metadata +74 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3b8dafd0a86f3def0e0b737532f34a43950de42fb61a4023c2418febe8c2d721
|
4
|
+
data.tar.gz: 74dc082a521f00cf6405c17550d86212b6939c348f292207972eed588f6b3333
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c0dabe14e1b1443f634ea7ba2b878c4523cd94fa5d4f0b01cbceb0471b438fe477004f4e4551ac299370eaf63b02b9adba7dc55f72f40e46088f97afc39771ea
|
7
|
+
data.tar.gz: abb59dfb73338c7c965fc0b73fce6623f46ca955c5ef1100981a1d20ff844cfe573a7dc78f3c006301b447ef3fedb916d23c7e6b71c3ff3b7e192424ead17337
|
data/.standard.yml
ADDED
data/CHANGELOG.md
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2024 crbelaus
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Jekyll::Tailwind
|
2
|
+
|
3
|
+
**This gem allows you integrate the [TailwindCSS Standalone CLI](https://tailwindcss.com/blog/standalone-cli) in your Jekyll site.** The Tailwind CLI is a standalone executable that doesn't need NodeJS or any other external dependency.
|
4
|
+
|
5
|
+
## Set up
|
6
|
+
|
7
|
+
To add this gem to your project you must include it in your Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
group :jekyll_plugins do
|
11
|
+
gem 'jekyll-tailwind'
|
12
|
+
end
|
13
|
+
```
|
14
|
+
|
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
|
+
|
17
|
+
It is important to note that **subsequent runs will use the existing Tailwind CLI and won't download it again.**
|
18
|
+
|
19
|
+
## Customize the Tailwind version
|
20
|
+
|
21
|
+
Although not strictly necessary, it is recommended to pin your desired Tailwind CLI version in `_config.yml`.
|
22
|
+
|
23
|
+
```yml
|
24
|
+
tailwind:
|
25
|
+
version: 3.4.1
|
26
|
+
```
|
27
|
+
|
28
|
+
If you don't do this, the gem will automatically download the latest Tailwind CLI version that was available when gem was published.
|
29
|
+
|
30
|
+
## Read the Tailwind configuration from an alternative path
|
31
|
+
|
32
|
+
By default Tailwind will read the `tailwind.config.js` file that lives in your project's root (more info at [the Tailwind docs](https://tailwindcss.com/docs/configuration)).
|
33
|
+
|
34
|
+
If your configuration file lives elsewhere you can say so in the `_config.yml` file:
|
35
|
+
|
36
|
+
```yml
|
37
|
+
tailwind:
|
38
|
+
config_path: assets/tailwind.config.js
|
39
|
+
```
|
@@ -0,0 +1,37 @@
|
|
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
|
@@ -0,0 +1,47 @@
|
|
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
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "jekyll-tailwind/version"
|
4
|
+
require_relative "jekyll-tailwind/installer"
|
5
|
+
|
6
|
+
require "jekyll"
|
7
|
+
|
8
|
+
Jekyll::Hooks.register [:site], :post_write do |site|
|
9
|
+
tailwind = Jekyll::Tailwind::Installer.new(
|
10
|
+
version: site.config.dig("tailwind", "version"),
|
11
|
+
config_path: site.config.dig("tailwind", "config_path")
|
12
|
+
)
|
13
|
+
tailwind.install_and_run
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-tailwind
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- crbelaus
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-03-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jekyll
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.0'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.0'
|
33
|
+
description: Run TailwindCSS from your Jekyll site without requiring NodeJS
|
34
|
+
email:
|
35
|
+
- cristian@crbelaus.com
|
36
|
+
executables: []
|
37
|
+
extensions: []
|
38
|
+
extra_rdoc_files: []
|
39
|
+
files:
|
40
|
+
- ".standard.yml"
|
41
|
+
- CHANGELOG.md
|
42
|
+
- LICENSE.txt
|
43
|
+
- README.md
|
44
|
+
- jekyll-tailwind.gemspec
|
45
|
+
- lib/jekyll-tailwind.rb
|
46
|
+
- lib/jekyll-tailwind/installer.rb
|
47
|
+
- lib/jekyll-tailwind/version.rb
|
48
|
+
homepage: https://github.com/crbelaus/jekyll-tailwind
|
49
|
+
licenses:
|
50
|
+
- MIT
|
51
|
+
metadata:
|
52
|
+
homepage_uri: https://github.com/crbelaus/jekyll-tailwind
|
53
|
+
source_code_uri: https://github.com/crbelaus/jekyll-tailwind
|
54
|
+
changelog_uri: https://github.com/crbelaus/jekyll-tailwind/blob/main/CHANGELOG.md
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options: []
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 2.6.0
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
requirements: []
|
70
|
+
rubygems_version: 3.5.3
|
71
|
+
signing_key:
|
72
|
+
specification_version: 4
|
73
|
+
summary: Use Tailwind CLI from your Jekyll site
|
74
|
+
test_files: []
|