Skip to content

Commit 77aac1b

Browse files
committed
Merge branch 'edge' of github.com:hyperstack-org/hyperstack into edge
2 parents a44ca86 + e5d339f commit 77aac1b

File tree

2 files changed

+428
-16
lines changed

2 files changed

+428
-16
lines changed

docs/installation/config.md

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,48 @@
11
# Configuration
22

3-
**Work in progress - ALPHA (docs and code)**
3+
Hyperstack configuration is set in an initializer.
44

5-
This gem is used internally by other [Hyperloop](http://ruby-hyperloop.io) gems for keeping config settings, and for registering client side autoload requirements.
5+
> Note: You will need to stop and start your Rails server when changing this configuration.
66
7-
To indicate gems to be autoloaded on client side:
7+
Example configuration:
88

99
```ruby
10-
require 'hyperloop-config'
11-
Hyperloop.import 'my-gem-name'
12-
Hyperloop.imports 'my-gem-name' # same as above
13-
Hyperloop.import 'my-gem-name', server_only: true
14-
Hyperloop.import 'my-gem-name', client_only: true
15-
Hyperloop.import 'path', tree: true # same as saying require_tree 'path' in a manifest file
16-
Hyperloop.import_tree 'path' # same as above
17-
Hyperloop.import 'asset_name' # same as saying require 'asset_name' in a manifest file
10+
# config/initializers/hyperstack.rb
11+
Hyperstack.configuration do |config|
12+
config.prerendering = :off
13+
14+
config.import 'jquery', client_only: true
15+
config.import 'hyperstack/component/jquery', client_only: true
16+
config.import 'browser'
17+
config.import 'active_support'
18+
19+
# config.import 'my-gem-name'
20+
# config.imports 'my-gem-name' # same as above
21+
# config.import 'my-gem-name', server_only: true
22+
# config.import 'my-gem-name', client_only: true
23+
# config.import 'path', tree: true # same as saying require_tree 'path' in a manifest file
24+
# config.import_tree 'path' # same as above
25+
# config.import 'asset_name' # same as saying require 'asset_name' in a manifest file
26+
27+
# Cancel importing React and ReactRouter if you are using Webpack
28+
# config.cancel_import 'react/react-source-browser'
29+
# config.cancel_import 'hyperstack/router/react-router-source'
30+
31+
if Rails.env.development?
32+
config.import 'hyperstack/hotloader', client_only: true
33+
config.hotloader_port = 25222
34+
end
35+
end
1836
```
1937

20-
Once a gem file spec does a `Hyperloop.import` the listed gem will be automatically added to the `hyperloop-loader` manifest. This means all you do is add a gem
21-
to rails, and it will get sent on to the client (plus any other dependencies you care to require.)
38+
The listed gem will be automatically added to the `hyperstack-loader` manifest. This means all you do is add a gem to Rails, and it will get sent on to the client (plus any other dependencies you care to require.)
2239

23-
The require method can be used in the hyperloop initializer as well to add code to the manifest (i.e. add a gem to that is not using Hyperloop.import)
40+
The require method can be used in the Hyperstack initializer as well to add code to the manifest (i.e. add a gem to that is not using Hyperstack.import)
2441

2542
To define an initializer:
2643

2744
```ruby
28-
module Hyperloop
45+
module Hyperstack
2946
on_config_reset do
3047
# anything you want to run when initialization begins
3148
end
@@ -37,7 +54,7 @@ module Hyperloop
3754
define_setting :default_prerendering_mode, :on
3855

3956
define_setting(:transport, :none) do |transport|
40-
# value of transport is whatever the user set in the initializer,
57+
# value of transport is whatever the user set in the initializer
4158
# you do what you want here...
4259
end
4360
```

0 commit comments

Comments
 (0)