tailwind.config.js uses hard-coded content paths
Closed this issue · 5 comments
rails g spina:install
creates a file app/assets/config/spina/tailwind.config.js
which starts like this:
module.exports = {
content: [
'/opt/homebrew/lib/ruby/gems/3.2.0/gems/spina-2.15.1/app/views/**/*.*',
'/opt/homebrew/lib/ruby/gems/3.2.0/gems/spina-2.15.1/app/components/**/*.*',
'/opt/homebrew/lib/ruby/gems/3.2.0/gems/spina-2.15.1/app/helpers/**/*.*',
'/opt/homebrew/lib/ruby/gems/3.2.0/gems/spina-2.15.1/app/assets/javascripts/**/*.js',
'/opt/homebrew/lib/ruby/gems/3.2.0/gems/spina-2.15.1/app/**/application.tailwind.css'
],
Shouldn't the paths be relative rather than absolute? The absolute paths will break whenever the device, Ruby or Spina version changes. As follows:
module.exports = {
content: [
'./app/views/**/*.*',
'./app/components/**/*.*',
'./app/helpers/**/*.*',
'./app/assets/javascripts/**/*.js',
'./app/**/application.tailwind.css'
],
This file is auto-generated on each assets:precompile :)
If it's auto-generated, why is it in VCS? And can it be edited?
Sorry I don't yet understand how deployment to production works.
You shouldnt add it to VCS. You dont have to precompile locally, after pushing to production you’ll have to run rails assets:precompile like with any other Rails app basically.
app/assets/config/spina/tailwind.config.js
gets added to VCS when generating a new app as follows:
rails new myapp --css=tailwind --database=postgresql
cd myapp
rails db:create
git add . && git commit -m "initial commit"
bundle add spina
rails active_storage:install
rails g spina:install
git add . && git commit -m "add Spina CMS"
Then run git log app/assets/config/spina/tailwind.config.js
and observe that the file is indeed checked in to VCS.
Shouldn't the file then be put in .gitignore
?
That'd be nicer, yes.