Module: Rack::Svelte
- Defined in:
- lib/rack/svelte.rb,
lib/rack/svelte/version.rb,
lib/rack/svelte/cogs.rb
Overview
Svelte for Rack w/ Cogs
Within a rackup file (or with Rack::Builder):
require 'rack/svelte'
use Rack::Svelte,
#:app_root_dir => ::File.expand_path('..', __FILE__),
#:app_root_dir => Rack::Directory.new('').root,
:components_dir_in => '/app/components',
:components_dir_out => '/public/app/js',
:format => 'iife'
run app
Rails example:
# above Rails::Initializer block
require 'rack/svelte'
# inside Rails::Initializer block
config.middleware.use Rack::Svelte,
:app_root_dir => Rails.root.to_s,
:components_dir_in => '/app/components',
:components_dir_out => '/public/app/js',
:format => 'iife'
Defined Under Namespace
Classes: Cogs
Constant Summary collapse
- VERSION =
'0.1.1'
Class Method Summary collapse
-
.new(backend, options = {}) ⇒ Object
Create a new Rack::Svelte middleware component that builds Svelte components using the svelte-ruby gem.
Class Method Details
.new(backend, options = {}) ⇒ Object
Create a new Rack::Svelte middleware component that builds Svelte components using the svelte-ruby gem. The options Hash can include any Svelte compiler options AND components_dir_in, components_dir_in
34 35 36 |
# File 'lib/rack/svelte.rb', line 34 def self.new(backend, = {}) Cogs.new(backend, ) end |