Sha256: ec46bcd864314cf933ff6686b18c12d8ccaf836b6decf1366f8f128549b5988a

Contents?: true

Size: 455 Bytes

Versions: 1

Compression:

Stored size: 455 Bytes

Contents

module Lookbook
  class Theme
    def initialize(config = {})
      @config = config
      @css = nil
    end

    def to_css
      return @css unless @css.nil?
      @css ||= if @config.present?
        styles = [":root {"]
        styles << @config.map do |key, value|
          "  --lookbook-#{key.to_s.underscore.gsub("_","-")}: #{value};"
        end
        styles.push "}"
        styles.join("\n")
      else
        ""
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lookbook-1.0.0.beta.0 lib/lookbook/theme.rb