From 48da798a14a2ccc615b429191dea93ded843f381 Mon Sep 17 00:00:00 2001 From: Matt Polito Date: Mon, 30 Sep 2024 22:43:36 -0400 Subject: [PATCH] fix: Continuous additions of tailwind config to gitinore --- .../spina/tailwind_config_generator.rb | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/generators/spina/tailwind_config_generator.rb b/lib/generators/spina/tailwind_config_generator.rb index ae2718aa5..ca9995957 100644 --- a/lib/generators/spina/tailwind_config_generator.rb +++ b/lib/generators/spina/tailwind_config_generator.rb @@ -2,14 +2,21 @@ module Spina class TailwindConfigGenerator < Rails::Generators::Base source_root File.expand_path("../templates", __FILE__) + CONFIG_FILE = "app/assets/config/spina/tailwind.config.js" + IGNORE_TEXT = <<~TEXT.chomp + # Ignore auto-generated Spina Tailwind CSS configuration + /#{CONFIG_FILE} + TEXT + def create_tailwind_config_file - filename = "app/assets/config/spina/tailwind.config.js" - template filename - insert_into_file ".gitignore", <<~TEXT + template CONFIG_FILE - # Ignore auto-generated Spina Tailwind CSS configuration - /#{filename} - TEXT + unless File.read(".gitignore").include?(IGNORE_TEXT) + append_to_file ".gitignore", <<~TEXT + \n + #{IGNORE_TEXT} + TEXT + end end end end