Skip to content

Commit

Permalink
refactor: tailwind.css file clashes with other files
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianthedev committed Dec 19, 2023
1 parent 1731147 commit db2c453
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions lib/generators/avo/tailwindcss/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ def create_files
end


unless (path = Rails.root.join("app", "assets", "stylesheets", "avo" ,"tailwind.css")).exist?
unless (path = Rails.root.join("app", "assets", "stylesheets", "avo" ,"avo.tailwind.css")).exist?
say "Add default tailwind.css"
copy_file template_path("avo.tailwind.css"), path
end

script_name = "avo:tailwind:css"
script_name = "avo:tailwindcss"
if Rails.root.join("Procfile.dev").exist?
say "Add #{cmd = "avo_css: yarn #{script_name} --watch"} to Procfile.dev"
append_to_file "Procfile.dev", "#{cmd}\n"
Expand All @@ -44,7 +44,7 @@ def create_files
run "gem install foreman"
end

script_command = "tailwindcss -i ./app/assets/stylesheets/avo/tailwind.css -o ./app/assets/builds/avo.tailwind.css -c ./config/avo/tailwind.config.js --minify"
script_command = "tailwindcss -i ./app/assets/stylesheets/avo/avo.tailwind.css -o ./app/assets/builds/avo.tailwind.css -c ./config/avo/tailwind.config.js --minify"
pretty_script_command = "\"#{script_name}\": \"#{script_command}\""

if (path = Rails.root.join("package.json")).exist?
Expand All @@ -69,12 +69,12 @@ def create_files
# When running `rake assets:precompile` this is the order of events:
# 1 - Task `avo:yarn_install`
# 2 - Task `avo:sym_link`
# 3 - Cmd `yarn avo:tailwind:css`
# 3 - Cmd `yarn avo:tailwindcss`
# 4 - Task `assets:precompile`
Rake::Task["assets:precompile"].enhance(["avo:sym_link"])
Rake::Task["avo:sym_link"].enhance(["avo:yarn_install"])
Rake::Task["avo:sym_link"].enhance do
`yarn avo:tailwind:css`
`yarn avo:tailwindcss`
end
RUBY
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/avo/templates/tailwindcss/Procfile.dev
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
web: bin/rails server -p 3000
avo_css: yarn avo:tailwind:css --watch
avo_css: yarn avo:tailwindcss --watch
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ module.exports = {
'./app/views/**/*.html.erb',
'./app/helpers/**/*.rb',
'./app/javascript/**/*.js',
]
],
}

0 comments on commit db2c453

Please sign in to comment.