SpinaCMS / Spina

Spina CMS
http://www.spinacms.com
Other
2.19k stars 405 forks source link

tailwind.config.js uses hard-coded content paths #1276

Closed sedubois closed 1 year ago

sedubois commented 1 year ago

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'
  ],
Bramjetten commented 1 year ago

This file is auto-generated on each assets:precompile :)

sedubois commented 1 year ago

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.

Bramjetten commented 1 year ago

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.

sedubois commented 1 year ago

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?

Bramjetten commented 1 year ago

That'd be nicer, yes.