jekyll-tailwindcss 0.1.0-x64-mingw32 → 0.2.0-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +112 -13
- data/lib/jekyll/converters/tailwindcss.rb +28 -3
- data/lib/jekyll-tailwindcss/version.rb +1 -1
- data/lib/tailwindcss/commands.rb +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27b0657f16878adc0235dfc96e54d1428baf56f3ece70dcde68effbe027acecc
|
4
|
+
data.tar.gz: 737ef5f35155cae8034ff51f0b6b92b13c74fd0bd552afe54f6fcb82408ecad5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ac78751ac65371fc794f0085bb0f841815e3edc6fd3aeec7c7888cba44434ae6bdee460325393f286d1a08f4e8f56aa52268448bd48bf8681b64dc2088ca929
|
7
|
+
data.tar.gz: 460464aa480bc6a860d12259314853b35a2d3f30c8193d97dadccec423bb8413498691a06a0c64aba25bc309d463e13f828c6ca61019350aa033a3755e16cb92
|
data/README.md
CHANGED
@@ -1,53 +1,152 @@
|
|
1
1
|
# Jekyll::Tailwindcss
|
2
2
|
|
3
|
+
Bring the fun of building with TailwindCSS into your Jekyll project (without any JavaScript)
|
4
|
+
|
5
|
+
**TL;DR** This gem borrows *heavily* from github.com/rails/tailwindcss-rails to provide platform-specific tailwind executables and provide a smooth developer experience in Jekyll projects
|
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
|
+
> “Because building a great jekyll site shouldn’t require a `node_modules` folder
|
10
|
+
|
3
11
|
## Installation
|
4
12
|
|
5
13
|
Install the gem in your jekyll project's Gemfile by executing the following:
|
6
14
|
|
7
|
-
```
|
8
|
-
|
15
|
+
```
|
16
|
+
bundle add jekyll-tailwindcss
|
9
17
|
```
|
10
18
|
|
11
|
-
Add
|
19
|
+
Add the plugin to your list of jekyll plugins in `_config.yml`
|
12
20
|
|
13
21
|
```yml
|
14
22
|
plugins:
|
15
23
|
- jekyll-tailwindcss
|
16
24
|
```
|
17
25
|
|
26
|
+
## Tailwind Configuration
|
27
|
+
|
28
|
+
This plugin requires you to have a tailwind configuration file (`tailwind.config.js`) at the root level of your project, which can be generated by running:
|
29
|
+
|
30
|
+
```
|
31
|
+
bundle exec tailwindcss init
|
32
|
+
```
|
33
|
+
|
34
|
+
Tailwind will include the CSS for the classes found in `content` directories. For most jekyll sites, this would work well.
|
35
|
+
|
36
|
+
```js
|
37
|
+
content: [
|
38
|
+
"./_includes/**/*.{html,liquid}",
|
39
|
+
"./_layouts/**/*.{html,liquid}",
|
40
|
+
"./_pages/*.{html,liquid}",
|
41
|
+
"./_posts/**/*.md",
|
42
|
+
"./*.md",
|
43
|
+
"./*.html",
|
44
|
+
],
|
45
|
+
```
|
46
|
+
|
47
|
+
Learn more at https://tailwindcss.com/docs/configuration
|
48
|
+
|
49
|
+
|
50
|
+
|
18
51
|
## Usage
|
19
52
|
|
20
|
-
|
53
|
+
```sh
|
54
|
+
bundle exec jekyll serve # or build
|
55
|
+
```
|
56
|
+
|
57
|
+
Any `*.css` file processed by jekyll [^1] that contains the `@tailwind` [directive](https://tailwindcss.com/docs/functions-and-directives#config) will now be converted through the Tailwind CLI.
|
58
|
+
|
59
|
+
[^1]: Jekyll will process any file that begins with yaml [frontmatter](https://jekyllrb.com/docs/front-matter/)
|
60
|
+
|
61
|
+
### Examples
|
21
62
|
|
22
|
-
**`tailwind.config.js`**
|
23
63
|
|
24
|
-
|
64
|
+
A CSS file with frontmatter and `@tailwind` directives:
|
25
65
|
|
26
|
-
|
66
|
+
```css
|
67
|
+
/* assets/css/styles.css */
|
68
|
+
---
|
69
|
+
# This yaml frontmatter is required for jekyll to process the file
|
70
|
+
---
|
27
71
|
|
28
|
-
|
72
|
+
@tailwind base;
|
73
|
+
@tailwind components;
|
74
|
+
@tailwind utilities;
|
29
75
|
|
30
|
-
|
76
|
+
.btn {
|
77
|
+
@apply font-bold py-2 px-4 rounded !important;
|
78
|
+
}
|
79
|
+
```
|
80
|
+
|
81
|
+
will be converted to
|
82
|
+
|
83
|
+
```css
|
84
|
+
/* _site/assets/css/styles.css */
|
31
85
|
|
32
|
-
|
86
|
+
/*
|
87
|
+
* Tailwind generated CSS
|
88
|
+
*/
|
89
|
+
```
|
33
90
|
|
34
|
-
For instance, `assets/css/styles.tailwindcss` will convert to `_site/assets/css/styles.css`
|
35
91
|
|
36
92
|
|
37
93
|
## Development
|
38
94
|
|
39
95
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
40
96
|
|
41
|
-
To install this gem
|
97
|
+
To install this gem on your local machine, run `bundle exec rake install`.
|
98
|
+
|
99
|
+
### Updating to the latest upstream tailwindcss version
|
100
|
+
|
101
|
+
Update `lib/tailwindcss/upstream.rb` with the upstream version.
|
102
|
+
|
103
|
+
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.
|
104
|
+
|
105
|
+
|
106
|
+
## Testing this gem
|
107
|
+
|
108
|
+
### Running the test suite
|
109
|
+
|
110
|
+
The unit tests are run with `bundle exec rspec`
|
111
|
+
|
112
|
+
There is an additional integration test which runs in CI, `spec/integration/user_journey_test.sh` which you may also want to run.
|
113
|
+
|
114
|
+
|
115
|
+
### Testing in a Jekyll project
|
116
|
+
|
117
|
+
If you want to test modifications to this gem, you must run `rake download` once to download the upstream `tailwindcss` executables.
|
118
|
+
|
119
|
+
Then you can point your Jekyll project's `Gemfile` at the local version of the gem as you normally would:
|
120
|
+
|
121
|
+
``` ruby
|
122
|
+
gem "jekyll-tailwindcss", path: "/path/to/jekyll-tailwindcss"
|
123
|
+
```
|
124
|
+
|
125
|
+
### Cutting a release
|
126
|
+
|
127
|
+
- bump the version
|
128
|
+
- [ ] update `lib/jekyll-tailwindcss/version.rb`
|
129
|
+
- [ ] update `CHANGELOG.md`
|
130
|
+
- [ ] commit and create a git tag
|
131
|
+
- build the native gems:
|
132
|
+
- [ ] `bundle exec rake clobber` to clean up possibly old tailwindcss executables
|
133
|
+
- [ ] `bundle exec rake package`
|
134
|
+
- push
|
135
|
+
- [ ] `for g in pkg/*.gem ; do gem push $g ; done`
|
136
|
+
- [ ] `git push`
|
137
|
+
- announce
|
138
|
+
- [ ] create a release at https://github.com/vormwald/jekyll-tailwindcss/releases
|
42
139
|
|
43
140
|
## Contributing
|
44
141
|
|
45
142
|
Bug reports and pull requests are welcome on GitHub at https://github.com/vormwald/jekyll-tailwindcss. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/vormwald/jekyll-tailwindcss/blob/main/CODE_OF_CONDUCT.md).
|
46
143
|
|
144
|
+
|
145
|
+
|
47
146
|
## License
|
48
147
|
|
49
148
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
50
149
|
|
51
150
|
## Code of Conduct
|
52
151
|
|
53
|
-
Everyone interacting in the Jekyll::Tailwindcss project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/vormwald/jekyll-tailwindcss/blob/main/CODE_OF_CONDUCT.md).
|
152
|
+
Everyone interacting in the Jekyll::Tailwindcss project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [code of conduct](https://github.com/vormwald/jekyll-tailwindcss/blob/main/CODE_OF_CONDUCT.md).
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "open3"
|
2
|
+
|
1
3
|
module Jekyll
|
2
4
|
module Converters
|
3
5
|
class Tailwindcss < Converter
|
@@ -5,20 +7,43 @@ module Jekyll
|
|
5
7
|
priority :low
|
6
8
|
|
7
9
|
def matches(ext)
|
8
|
-
/^\.
|
10
|
+
/^\.css$/i.match?(ext)
|
9
11
|
end
|
10
12
|
|
11
13
|
def output_ext(ext)
|
12
|
-
|
14
|
+
# At this point, we will have a CSS file
|
15
|
+
ext
|
13
16
|
end
|
14
17
|
|
15
18
|
def convert(content)
|
19
|
+
return content unless /@tailwind/i.match?(content)
|
20
|
+
|
16
21
|
dev_mode = Jekyll.env == "development"
|
17
22
|
Jekyll.logger.info "Jekyll Tailwind:", "Generating #{dev_mode ? "" : "minified "}CSS"
|
18
23
|
|
19
24
|
compile_command = ::Tailwindcss::Commands.compile_command(debug: dev_mode).join(" ")
|
20
25
|
|
21
|
-
|
26
|
+
output, error = nil
|
27
|
+
Open3.popen3(tailwindcss_env_options, compile_command) do |stdin, stdout, stderr, _wait_thread|
|
28
|
+
stdin.write content # write the content of *.tailwindcss to the tailwindcss CLI as input
|
29
|
+
stdin.close
|
30
|
+
error = stderr.read
|
31
|
+
output = stdout.read
|
32
|
+
end
|
33
|
+
Jekyll.logger.warn "Jekyll Tailwind:", error unless error.nil?
|
34
|
+
|
35
|
+
output
|
36
|
+
rescue => e
|
37
|
+
Jekyll.logger.error "Jekyll Tailwind:", e.message
|
38
|
+
content
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def tailwindcss_env_options
|
44
|
+
# Without this ENV you'll get a warning about `Browserslist: caniuse-lite is outdated`
|
45
|
+
# Since we're using the CLI, we can't update the data, so we ignore it.
|
46
|
+
{"BROWSERSLIST_IGNORE_OLD_DATA" => "1"}
|
22
47
|
end
|
23
48
|
end
|
24
49
|
end
|
data/lib/tailwindcss/commands.rb
CHANGED
@@ -76,8 +76,8 @@ module Tailwindcss
|
|
76
76
|
def compile_command(debug: false, **kwargs)
|
77
77
|
command = [
|
78
78
|
executable(**kwargs),
|
79
|
-
"
|
80
|
-
"
|
79
|
+
"--input", "-",
|
80
|
+
"--config", "./tailwind.config.js"
|
81
81
|
]
|
82
82
|
|
83
83
|
command << "--minify" unless debug
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-tailwindcss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: x64-mingw32
|
6
6
|
authors:
|
7
7
|
- Mike Vormwald
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description:
|
14
14
|
email:
|
15
15
|
- mvormwald@gmail.com
|
16
16
|
executables:
|
@@ -34,7 +34,7 @@ licenses:
|
|
34
34
|
- MIT
|
35
35
|
metadata:
|
36
36
|
homepage_uri: https://github.com/vormwald/jekyll-tailwindcss
|
37
|
-
post_install_message:
|
37
|
+
post_install_message:
|
38
38
|
rdoc_options: []
|
39
39
|
require_paths:
|
40
40
|
- lib
|
@@ -49,8 +49,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '0'
|
51
51
|
requirements: []
|
52
|
-
rubygems_version: 3.
|
53
|
-
signing_key:
|
52
|
+
rubygems_version: 3.5.7
|
53
|
+
signing_key:
|
54
54
|
specification_version: 4
|
55
55
|
summary: Integrate Tailwind CSS into your Jekyll site.
|
56
56
|
test_files: []
|