jekyll-tailwind-cli 0.1.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/LICENSE.txt +21 -0
- data/README.md +61 -0
- data/Rakefile +1 -0
- data/lib/jekyll-tailwind-cli/installer.rb +51 -0
- data/lib/jekyll-tailwind-cli/version.rb +7 -0
- data/lib/jekyll-tailwind-cli.rb +21 -0
- metadata +86 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 28a76f9d8fe8b29a2c6d71dd0a3b81ebe29237525e83951410f1d7707be5eb5c
|
4
|
+
data.tar.gz: 736c273d0cac35717ff6b737ac03b98220593a367c6cce98ff6e564f0121a2c4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 075a8326f10761482124de7d321ad3fa5fd8a974d89ad2bc22010f7fb95844e465e7640165dc9875fc4d219d1a02b9ba462f521954d866149a1a7ca749f55edd
|
7
|
+
data.tar.gz: b29213cb464a353c4cda08e4aa55c0e2b9f636cf205a145c12907e48fac276da3a7f1343fe8ffa42e992fddff8f3ecfd714b6f0715e70555949cdf85b9f34c6d
|
data/.standard.yml
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,61 @@
|
|
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
|
+
This gem was originally inspired by https://github.com/crbelaus/jekyll-tailwind
|
6
|
+
## Set up
|
7
|
+
|
8
|
+
To add this gem to your project you must include it in your Gemfile:
|
9
|
+
|
10
|
+
1. Add a gem
|
11
|
+
```ruby
|
12
|
+
group :jekyll_plugins do
|
13
|
+
gem 'jekyll-tailwind-cli'
|
14
|
+
end
|
15
|
+
```
|
16
|
+
|
17
|
+
2. Add **tailwind.config.js** to root directory with following contents
|
18
|
+
```js
|
19
|
+
module.exports = {
|
20
|
+
content: ["./**/*.html", "./**/*.md"],
|
21
|
+
theme: {
|
22
|
+
extend: {},
|
23
|
+
},
|
24
|
+
plugins: [],
|
25
|
+
};
|
26
|
+
```
|
27
|
+
|
28
|
+
3. Add **assets/app.css** file with following contents
|
29
|
+
```css
|
30
|
+
@tailwind base;
|
31
|
+
@tailwind components;
|
32
|
+
@tailwind utilities;
|
33
|
+
```
|
34
|
+
4. Modify default template to include app.css, e.g.:
|
35
|
+
`<link rel="stylesheet" href="{{ "/assets/css/app.css" | relative_url }}">`
|
36
|
+
|
37
|
+
**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.
|
38
|
+
|
39
|
+
It is important to note that **subsequent runs will use the existing Tailwind CLI and won't download it again.**
|
40
|
+
|
41
|
+
## Customize the Tailwind version
|
42
|
+
|
43
|
+
Although not strictly necessary, it is recommended to pin your desired Tailwind CLI version in `_config.yml`.
|
44
|
+
|
45
|
+
```yml
|
46
|
+
tailwind:
|
47
|
+
version: 3.4.1
|
48
|
+
```
|
49
|
+
|
50
|
+
If you don't do this, the gem will automatically download the latest Tailwind CLI version that was available when gem was published.
|
51
|
+
|
52
|
+
## Read the Tailwind configuration from an alternative path
|
53
|
+
|
54
|
+
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)).
|
55
|
+
|
56
|
+
If your configuration file lives elsewhere you can say so in the `_config.yml` file:
|
57
|
+
|
58
|
+
```yml
|
59
|
+
tailwind:
|
60
|
+
config_path: assets/tailwind.config.js
|
61
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,51 @@
|
|
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-darwin/
|
13
|
+
'macos-arm64'
|
14
|
+
when /^x86_64-darwin/
|
15
|
+
'macos-x64'
|
16
|
+
when 'x86_64-linux'
|
17
|
+
'linux-x64'
|
18
|
+
else
|
19
|
+
raise "Tailwind CLI is not available for platform: #{RUBY_PLATFORM}"
|
20
|
+
end
|
21
|
+
|
22
|
+
@version = options[:version] || '3.4.1'
|
23
|
+
@config_path = options[:config_path] || 'tailwind.config.js'
|
24
|
+
@path = "_tailwind/tailwind-#{@target}-#{@version}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def check_install
|
28
|
+
install unless File.exist?(@path)
|
29
|
+
end
|
30
|
+
|
31
|
+
def build
|
32
|
+
Jekyll.logger.info 'Tailwind:', 'Rebuilt _site/assets/css/app.css'
|
33
|
+
`#{@path} --input _site/assets/css/app.css --output _site/assets/css/app.css --config #{@config_path}`
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def install
|
39
|
+
Jekyll.logger.info 'Tailwind:', "CLI version #{@version} not found for #{@target}"
|
40
|
+
Jekyll.logger.info 'Tailwind:', 'Installing...'
|
41
|
+
|
42
|
+
uri = URI.parse("https://github.com/tailwindlabs/tailwindcss/releases/download/v#{@version}/tailwindcss-#{@target}")
|
43
|
+
file = uri.open
|
44
|
+
|
45
|
+
FileUtils.mkdir '_tailwind' unless File.exist?('_tailwind')
|
46
|
+
FileUtils.install file.path, @path, mode: 0o755
|
47
|
+
|
48
|
+
Jekyll.logger.info 'Tailwind:', "CLI installed at #{@path}"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "jekyll-tailwind-cli/version"
|
4
|
+
require_relative "jekyll-tailwind-cli/installer"
|
5
|
+
|
6
|
+
require "jekyll"
|
7
|
+
|
8
|
+
def tailwind(site)
|
9
|
+
Jekyll::Tailwind::Installer.new(
|
10
|
+
version: site.config.dig("tailwind", "version"),
|
11
|
+
config_path: site.config.dig("tailwind", "config_path")
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
Jekyll::Hooks.register [:site], :post_read do |site|
|
16
|
+
tailwind(site).check_install
|
17
|
+
end
|
18
|
+
|
19
|
+
Jekyll::Hooks.register [:site], :pre_render do |site|
|
20
|
+
tailwind(site).build
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-tailwind-cli
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- skatkov
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-09-20 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
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rake
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
description: Run TailwindCSS from your Jekyll site without requiring NodeJS
|
48
|
+
email:
|
49
|
+
- github@skatkov.com
|
50
|
+
executables: []
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- ".standard.yml"
|
55
|
+
- LICENSE.txt
|
56
|
+
- README.md
|
57
|
+
- Rakefile
|
58
|
+
- lib/jekyll-tailwind-cli.rb
|
59
|
+
- lib/jekyll-tailwind-cli/installer.rb
|
60
|
+
- lib/jekyll-tailwind-cli/version.rb
|
61
|
+
homepage: https://github.com/skatkov/jekyll-tailwind-cli
|
62
|
+
licenses:
|
63
|
+
- MIT
|
64
|
+
metadata:
|
65
|
+
homepage_uri: https://github.com/skatkov/jekyll-tailwind-cli
|
66
|
+
source_code_uri: https://github.com/skatkov/jekyll-tailwind-cli
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.6.0
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
requirements: []
|
82
|
+
rubygems_version: 3.5.9
|
83
|
+
signing_key:
|
84
|
+
specification_version: 4
|
85
|
+
summary: Use Tailwind CLI with a Jekyll site
|
86
|
+
test_files: []
|