Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ gem "standard", "~> 1.3"

# needed as a jekyll dependency since ruby 3.4/4.0 removed them
gem "csv"
gem "base64"
gem "logger"
gem "base64"

# transitive deps whose newer releases require ruby >= 3.2; CI still tests ruby 3.1
gem "rdoc", "< 8" # rdoc 8 requires ruby >= 3.2 and pulls in rbs (also >= 3.2)
gem "erb", "< 5" # erb >= 6 requires ruby >= 3.2
gem "sass-embedded", "< 1.77.1" # sass-embedded >= 1.77.1 requires ruby >= 3.2
gem "google-protobuf", "< 4.36" # google-protobuf >= 4.36 requires ruby >= 3.2

group :development, :test do
gem "irb", "~> 1.14"
Expand Down
21 changes: 17 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,19 @@ GEM
erb (4.0.4.1)
cgi (>= 0.3.3)
eventmachine (1.2.7)
ffi (1.17.1)
ffi (1.17.4)
ffi (1.17.4-arm64-darwin)
ffi (1.17.4-x86_64-linux-gnu)
forwardable-extended (2.6.0)
google-protobuf (4.33.6)
google-protobuf (4.35.1)
bigdecimal
rake (>= 13)
rake (~> 13.3)
google-protobuf (4.35.1-arm64-darwin)
bigdecimal
rake (~> 13.3)
google-protobuf (4.35.1-x86_64-linux-gnu)
bigdecimal
rake (~> 13.3)
http_parser.rb (0.8.0)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -90,7 +98,7 @@ GEM
public_suffix (6.0.1)
racc (1.8.1)
rainbow (3.1.1)
rake (13.2.1)
rake (13.4.2)
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
Expand Down Expand Up @@ -136,6 +144,8 @@ GEM
sass-embedded (1.77.0)
google-protobuf (>= 3.25, < 5.0)
rake (>= 13.0.0)
sass-embedded (1.77.0-arm64-darwin)
google-protobuf (>= 3.25, < 5.0)
sass-embedded (1.77.0-x86_64-linux-gnu)
google-protobuf (>= 3.25, < 5.0)
standard (1.44.0)
Expand All @@ -152,6 +162,7 @@ GEM
rubocop-performance (~> 1.23.0)
stringio (3.2.0)
tailwindcss-ruby (4.0.6)
tailwindcss-ruby (4.0.6-arm64-darwin)
tailwindcss-ruby (4.0.6-x86_64-linux-gnu)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
Expand All @@ -160,13 +171,15 @@ GEM
webrick (1.9.1)

PLATFORMS
arm64-darwin
ruby
x86_64-linux

DEPENDENCIES
base64
csv
erb (< 5)
google-protobuf (< 4.36)
irb (~> 1.14)
jekyll (~> 4.3)
jekyll-tailwindcss!
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/site/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
title: Integration Spec Fixture Site
10 changes: 10 additions & 0 deletions spec/fixtures/site/_layouts/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/assets/css/styles.css">
</head>
<body>
<h1 class="text-center font-bold">{{ page.title }}</h1>
{{ content }}
</body>
</html>
1 change: 1 addition & 0 deletions spec/fixtures/site/_tailwind.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "tailwindcss";
3 changes: 3 additions & 0 deletions spec/fixtures/site/assets/css/styles.tailwindcss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
---
This file is just a placeholder. Its content will be replaced by output from the tailwindcss CLI.
6 changes: 6 additions & 0 deletions spec/fixtures/site/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: default
title: Home
---

Hello from the integration spec fixture site.
42 changes: 42 additions & 0 deletions spec/integration/build_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# frozen_string_literal: true

require "spec_helper"
require "jekyll"
require "tmpdir"
require "fileutils"

RSpec.describe "building a Jekyll site with the real tailwindcss CLI" do
let(:fixture_source) { File.expand_path("../fixtures/site", __dir__) }

it "generates real tailwind-compiled CSS into _site" do
Dir.mktmpdir do |tmp|
# Build from a throwaway copy of the fixture: Jekyll writes its disk cache
# (.jekyll-cache) under the site source, so building in place would leave
# artifacts behind in the repository.
source = File.join(tmp, "site")
destination = File.join(tmp, "_site")
FileUtils.cp_r(fixture_source, source)

# The plugin resolves the tailwind css config path (default "./_tailwind.css")
# relative to the process working directory rather than the site source,
# so the site being built must be the cwd for the build to find it.
Dir.chdir(source) do
config = Jekyll.configuration(
"source" => source,
"destination" => destination,
"quiet" => true
)
site = Jekyll::Site.new(config)
site.process
end

generated_css_path = File.join(destination, "assets", "css", "styles.css")

expect(File).to exist(generated_css_path)

generated_css = File.read(generated_css_path)
expect(generated_css).not_to be_empty
expect(generated_css).to match(/text-center/)
end
end
end
Loading