Sha256: 09091366a3c11ace69a0a655e080213b09d506090ae9feff73aef1327024b02a

Contents?: true

Size: 1021 Bytes

Versions: 13

Compression:

Stored size: 1021 Bytes

Contents

# frozen_string_literal: true

module TailwindDsl
  module Etl
    module RawComponents
      # NOTE: Load is badly named.

      # Use the Load to build the UiKit which will store the JSON representations of each Design System plus components.
      #
      # This is a raw representation of the source.
      #
      # This data structure will be used by the component transformer to build
      # auxiliary data structures for components such as clean HTML, Astro, data shapes.
      class Load
        attr_reader :uikit

        def initialize
          @uikit = ::TailwindDsl::Etl::RawComponents::UiKit.new
        end

        def add_design_system(path, name: nil)
          name = (name || File.basename(path)).to_s

          design_system = Transformer.new.call(name, path)

          uikit.add_design_system(design_system)
        end

        def write(file)
          FileUtils.mkdir_p(File.dirname(file))
          File.write(file, JSON.pretty_generate(uikit.to_h))
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
tailwind_dsl-0.0.32 lib/tailwind_dsl/etl/raw_components/load.rb
tailwind_dsl-0.0.31 lib/tailwind_dsl/etl/raw_components/load.rb
tailwind_dsl-0.0.30 lib/tailwind_dsl/etl/raw_components/load.rb
tailwind_dsl-0.0.29 lib/tailwind_dsl/etl/raw_components/load.rb
tailwind_dsl-0.0.28 lib/tailwind_dsl/etl/raw_components/load.rb
tailwind_dsl-0.0.27 lib/tailwind_dsl/etl/raw_components/load.rb
tailwind_dsl-0.0.26 lib/tailwind_dsl/etl/raw_components/load.rb
tailwind_dsl-0.0.25 lib/tailwind_dsl/etl/raw_components/load.rb
tailwind_dsl-0.0.24 lib/tailwind_dsl/etl/raw_components/load.rb
tailwind_dsl-0.0.23 lib/tailwind_dsl/etl/raw_components/load.rb
tailwind_dsl-0.0.22 lib/tailwind_dsl/etl/raw_components/load.rb
tailwind_dsl-0.0.21 lib/tailwind_dsl/etl/raw_components/load.rb
tailwind_dsl-0.0.20 lib/tailwind_dsl/etl/raw_components/load.rb