Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: tailwind.css file clashes with other files #2253

Merged
merged 2 commits into from Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/generators/avo/tailwindcss/install_generator.rb
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?
Paul-Bob marked this conversation as resolved.
Show resolved Hide resolved
say "Add default tailwind.css"
copy_file template_path("avo.tailwind.css"), path
end

script_name = "avo:tailwind:css"
Paul-Bob marked this conversation as resolved.
Show resolved Hide resolved
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"
Paul-Bob marked this conversation as resolved.
Show resolved Hide resolved
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
@@ -1,2 +1,2 @@
web: bin/rails server -p 3000
avo_css: yarn avo:tailwind:css --watch
avo_css: yarn avo:tailwindcss --watch
Expand Up @@ -7,5 +7,5 @@ module.exports = {
'./app/views/**/*.html.erb',
'./app/helpers/**/*.rb',
'./app/javascript/**/*.js',
]
],
}