Sha256: fd73f7d4fe0e910694360775446bb0ed04f2aecd50fd8c400e59673e131056d4

Contents?: true

Size: 958 Bytes

Versions: 5

Compression:

Stored size: 958 Bytes

Contents

require "rails/generators/base"

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
signum-0.7.8 lib/generators/signum/tailwind_config_generator.rb
signum-0.7.4 lib/generators/signum/tailwind_config_generator.rb
signum-0.7.2 lib/generators/signum/tailwind_config_generator.rb
signum-0.7.1 lib/generators/signum/tailwind_config_generator.rb
signum-0.7.0 lib/generators/signum/tailwind_config_generator.rb