Sha256: 6a8ced6025bc47f663502db190fe623661856159e5fda50fa04f3531eb48757a
Contents?: true
Size: 863 Bytes
Versions: 1
Compression:
Stored size: 863 Bytes
Contents
# frozen_string_literal: true require 'nokogiri' # Helper class for injecting styles into DOM. class ::AmberComponent::StyleInjector class << self # Injects styles into the DOM, or returns string if # DOM stucture is not available. # # @param style [String] # @return [String, nil] def inject(style) injector = new(style) injector.run end end # @param style [String] def initialize(style) @style = style end # @return [void] def run return dom_tag unless dom_available? insert_style_in_head nil end private # @return [Boolean] def dom_available? false # check for header in DOM rendrer end # @return [void] def insert_style_in_head false end # @return [String] def dom_tag <<~HTML <style type='text/css'>#{@style}</style> HTML end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
amber_component-0.0.2 | lib/amber_component/style_injector.rb |