diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 111d8bce..2f065403 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby: [2.7, "3.0"] + ruby: [2.7, "3.0", 3.1] steps: - uses: actions/checkout@v2 diff --git a/Gemfile.lock b/Gemfile.lock index 736e1302..77c713c4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - tailwindcss-rails (2.0.7) + tailwindcss-rails (2.0.8) railties (>= 6.0.0) GEM diff --git a/README.md b/README.md index 3f0e4ee0..d3f5bab6 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,27 @@ A fix for this has been proposed upstream at https://github.com/tailwindlabs/tai apk add build-base gcompat ``` +### Using asset-pipeline assets + +In Rails, you want to use [assets from the asset pipeline to get fingerprinting](https://guides.rubyonrails.org/asset_pipeline.html#what-is-fingerprinting-and-why-should-i-care-questionmark). However, Tailwind isn't aware of those assets. To use assets from the pipeline, use `url(image.svg)`. [Since Sprockets v3.3.0](https://github.com/rails/sprockets-rails/pull/476) `url(image.svg)` will then automatically be rewritten to `/path/to/assets/image-7801e7538c6f1cc57aa75a5876ab0cac.svg`. So the output CSS will have the correct path to those assets. + +```js +module.exports = { + theme: { + extend: { + backgroundImage: { + 'image': "url('image.svg')" + } + } + } +} +``` + +The inline version also works: + +```html +
Has the image as it's background
+``` ## License diff --git a/lib/install/tailwind.config.js b/lib/install/tailwind.config.js index fd336d86..34c0c842 100644 --- a/lib/install/tailwind.config.js +++ b/lib/install/tailwind.config.js @@ -4,7 +4,7 @@ module.exports = { content: [ './app/helpers/**/*.rb', './app/javascript/**/*.js', - './app/views/**/*' + './app/views/**/*.{erb,haml,html,slim}' ], theme: { extend: { diff --git a/lib/tailwindcss/upstream.rb b/lib/tailwindcss/upstream.rb index 76eae743..489bbe4a 100644 --- a/lib/tailwindcss/upstream.rb +++ b/lib/tailwindcss/upstream.rb @@ -1,7 +1,7 @@ module Tailwindcss # constants describing the upstream tailwindcss project module Upstream - VERSION = "v3.0.22" + VERSION = "v3.0.23" # rubygems platform name => upstream release filename NATIVE_PLATFORMS = { diff --git a/lib/tailwindcss/version.rb b/lib/tailwindcss/version.rb index d670ecf2..62f41fb6 100644 --- a/lib/tailwindcss/version.rb +++ b/lib/tailwindcss/version.rb @@ -1,3 +1,3 @@ module Tailwindcss - VERSION = "2.0.7" + VERSION = "2.0.8" end diff --git a/lib/tasks/build.rake b/lib/tasks/build.rake index 586ac0d6..760a478e 100644 --- a/lib/tasks/build.rake +++ b/lib/tasks/build.rake @@ -1,4 +1,4 @@ -TAILWIND_COMPILE_COMMAND = "#{Pathname.new(__dir__).to_s}/../../exe/tailwindcss -i #{Rails.root.join("app/assets/stylesheets/application.tailwind.css")} -o #{Rails.root.join("app/assets/builds/tailwind.css")} -c #{Rails.root.join("config/tailwind.config.js")} --minify" +TAILWIND_COMPILE_COMMAND = "#{RbConfig.ruby} #{Pathname.new(__dir__).to_s}/../../exe/tailwindcss -i #{Rails.root.join("app/assets/stylesheets/application.tailwind.css")} -o #{Rails.root.join("app/assets/builds/tailwind.css")} -c #{Rails.root.join("config/tailwind.config.js")} --minify" namespace :tailwindcss do desc "Build your Tailwind CSS"