diff --git a/Gemfile b/Gemfile index 26dacf1..b0b6d95 100644 --- a/Gemfile +++ b/Gemfile @@ -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" diff --git a/Gemfile.lock b/Gemfile.lock index 5c8e841..c91ec0d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) @@ -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) @@ -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) @@ -160,6 +171,7 @@ GEM webrick (1.9.1) PLATFORMS + arm64-darwin ruby x86_64-linux @@ -167,6 +179,7 @@ DEPENDENCIES base64 csv erb (< 5) + google-protobuf (< 4.36) irb (~> 1.14) jekyll (~> 4.3) jekyll-tailwindcss! diff --git a/spec/fixtures/site/_config.yml b/spec/fixtures/site/_config.yml new file mode 100644 index 0000000..f0f30b4 --- /dev/null +++ b/spec/fixtures/site/_config.yml @@ -0,0 +1 @@ +title: Integration Spec Fixture Site diff --git a/spec/fixtures/site/_layouts/default.html b/spec/fixtures/site/_layouts/default.html new file mode 100644 index 0000000..5e319e3 --- /dev/null +++ b/spec/fixtures/site/_layouts/default.html @@ -0,0 +1,10 @@ + + + + + + +

{{ page.title }}

+ {{ content }} + + diff --git a/spec/fixtures/site/_tailwind.css b/spec/fixtures/site/_tailwind.css new file mode 100644 index 0000000..f1d8c73 --- /dev/null +++ b/spec/fixtures/site/_tailwind.css @@ -0,0 +1 @@ +@import "tailwindcss"; diff --git a/spec/fixtures/site/assets/css/styles.tailwindcss b/spec/fixtures/site/assets/css/styles.tailwindcss new file mode 100644 index 0000000..8fb6cc2 --- /dev/null +++ b/spec/fixtures/site/assets/css/styles.tailwindcss @@ -0,0 +1,3 @@ +--- +--- +This file is just a placeholder. Its content will be replaced by output from the tailwindcss CLI. diff --git a/spec/fixtures/site/index.md b/spec/fixtures/site/index.md new file mode 100644 index 0000000..3134cd9 --- /dev/null +++ b/spec/fixtures/site/index.md @@ -0,0 +1,6 @@ +--- +layout: default +title: Home +--- + +Hello from the integration spec fixture site. diff --git a/spec/integration/build_spec.rb b/spec/integration/build_spec.rb new file mode 100644 index 0000000..507c3ae --- /dev/null +++ b/spec/integration/build_spec.rb @@ -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