Sha256: a8ca6fbb79a59ddbd96a5cae6610bc39c11a8ef537d1833a8c94c1050fa6f52d

Contents?: true

Size: 953 Bytes

Versions: 13

Compression:

Stored size: 953 Bytes

Contents

require "rails/generators/base"

module Satis
  module Generators
    class TailwindConfigGenerator < Rails::Generators::Base
      source_root File.expand_path("../templates", __dir__)
      desc "Configures tailwind.config.js and application.tailwindcss.css"

      def add_content_to_tailwind_config
        inject_into_file "config/tailwind.config.js", before: "],\n  theme: {" do
          "  // Satis content\n" +
            %w[/app/views/**/* /app/helpers/**/* /app/controllers/**/* /app/components/**/* /app/javascript/**/*.js /app/assets/**/*.css].map { |path| "    \"#{Satis::Engine.root}#{path}\"" }.join(",\n") +
            ",\n  "
        end
      end

      def add_content_application_tailwind_css
        inject_into_file "app/assets/stylesheets/application.tailwind.css", before: "@tailwind base;" do
          "@import '#{Satis::Engine.root}/app/assets/stylesheets/satis/application.css';\n"
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
importo-3.0.21 lib/generators/satis/tailwind_config_generator.rb
importo-3.0.20 lib/generators/satis/tailwind_config_generator.rb
importo-3.0.19 lib/generators/satis/tailwind_config_generator.rb
importo-3.0.18 lib/generators/satis/tailwind_config_generator.rb
importo-3.0.17 lib/generators/satis/tailwind_config_generator.rb
importo-3.0.16 lib/generators/satis/tailwind_config_generator.rb
importo-3.0.15 lib/generators/satis/tailwind_config_generator.rb
importo-3.0.14 lib/generators/satis/tailwind_config_generator.rb
importo-3.0.13 lib/generators/satis/tailwind_config_generator.rb
importo-3.0.12 lib/generators/satis/tailwind_config_generator.rb
importo-3.0.11 lib/generators/satis/tailwind_config_generator.rb
importo-3.0.10 lib/generators/satis/tailwind_config_generator.rb
importo-3.0.9 lib/generators/satis/tailwind_config_generator.rb