Sha256: b3f8483cfd9c8cb38ce2781339b11a61f56f82927a1ea1582aa7c05666edd688
Contents?: true
Size: 1.08 KB
Versions: 4
Compression:
Stored size: 1.08 KB
Contents
require 'volt/server/html_parser/view_parser' require 'volt/server/component_templates' require 'volt/server/rack/asset_files' # Takes in the name and all component paths and has a .code # method that returns all of the ruby setup code for the component. module Volt class ComponentCode def initialize(component_name, component_paths, client = true) @component_name = component_name @component_paths = component_paths @client = client end # The client argument is for if this code is being generated for the client def code # Start with config code code = @client ? generate_config_code : '' asset_files = AssetFiles.from_cache(@component_name, @component_paths) asset_files.component_paths.each do |component_path, component_name| code << ComponentTemplates.new(component_path, component_name, @client).code code << "\n\n" end code end def generate_config_code # Setup Volt.config on the client "\nVolt.setup_client_config(#{Volt.config.public.to_h.inspect})\n" end end end
Version data entries
4 entries across 4 versions & 1 rubygems