Sha256: dbb576bd8c313bd81d5bf97109859fbb83c5cb290590fddcf2d01aad7f5dc19f

Contents?: true

Size: 958 Bytes

Versions: 6

Compression:

Stored size: 958 Bytes

Contents

require 'rails/generators/base'

module Scribo
  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
          "  // Scribo content\n" +
            %w[/app/views/**/* /app/helpers/**/* /app/controllers/**/* /app/components/**/* /app/javascript/**/*.js /app/assets/**/*.css].map { |path| "    \"#{Scribo::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 '#{Scribo::Engine.root}/app/assets/stylesheets/scribo/application.css';\n"
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
scribo-1.0.44 lib/generators/scribo/tailwind_config_generator.rb
scribo-1.0.43 lib/generators/scribo/tailwind_config_generator.rb
scribo-1.0.42 lib/generators/scribo/tailwind_config_generator.rb
scribo-1.0.41 lib/generators/scribo/tailwind_config_generator.rb
scribo-1.0.40 lib/generators/scribo/tailwind_config_generator.rb
scribo-1.0.39 lib/generators/scribo/tailwind_config_generator.rb