js_render 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/lib/js_render/configuration.rb +3 -1
- data/lib/js_render/renderer.rb +2 -0
- data/lib/js_render/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3537448b722ff236b75da2d4f60f5c69fbfa6290
|
4
|
+
data.tar.gz: 177de4414b1c645c485fbc6ef1b3bebe5b4a968f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97646f57c0c1428117e0ca0d2bb849f0cf04d6c5cdff34a3fd0f03cdb225f3668ff528b309b7ede336ec335493a7c377e61f46f6f2f651acac2ca89a5f6f14b3
|
7
|
+
data.tar.gz: 6869b116f9fdeb9842164f57727ad5878752f67da1e90976e7ca76c85e669c54f67dea3430b304d8c5231d13c3f699c8d50ff2c0aca478f49e2fe3ddb943f312
|
data/README.md
CHANGED
@@ -3,8 +3,6 @@
|
|
3
3
|
|
4
4
|
# JsRender
|
5
5
|
|
6
|
-
**Disclaimer: This is currently a "work in progress". More functionality, improvements, and docs are coming. That said everything does work, but the API might change in the near future. Check out the docs below as well as the [`examples`](./examples).**
|
7
|
-
|
8
6
|
JsRender is an unopinionated Ruby library for rendering JavaScript "components" on the server side. This approach works with [React](https://facebook.github.io/react/), [Angular](ihttps://angular.io/), [Ember](http://emberjs.com/), or any other library of your choice. The only requirement is that there is a JavaScript function that returns HTML for the component or view such that it can be properly rendered on the server side (e.g. [`ReactDOMServer.renderToString`](https://facebook.github.io/react/docs/top-level-api.html#reactdomserver.rendertostring) in React).
|
9
7
|
|
10
8
|
The library works in two essential parts:
|
@@ -152,6 +150,12 @@ Methods you can override if you subclass `JsRender::AssetFinder::Base`:
|
|
152
150
|
|
153
151
|
> Defaults to `nil`
|
154
152
|
|
153
|
+
** should_server_render **
|
154
|
+
|
155
|
+
This config option is a boolean that specifies if the server render function and associated JS should be executed and run. When it is false, it only returns the span with the unique ID that the client side render function relies upon. This is meant for development purposes and enables things like console logging etc. that would normally cause errors in the `ExecJS` runtime.
|
156
|
+
|
157
|
+
> Defaults to `true`
|
158
|
+
|
155
159
|
## Development
|
156
160
|
|
157
161
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -22,7 +22,8 @@ module JsRender
|
|
22
22
|
:server_render_function,
|
23
23
|
:client_render_function,
|
24
24
|
:use_asset_pipeline,
|
25
|
-
:asset_finder_class
|
25
|
+
:asset_finder_class,
|
26
|
+
:should_server_render
|
26
27
|
|
27
28
|
def initialize
|
28
29
|
@base_path = 'app/assets/javascripts'
|
@@ -32,6 +33,7 @@ module JsRender
|
|
32
33
|
@client_render_function = 'window.render*Client'
|
33
34
|
@use_asset_pipeline = false
|
34
35
|
@asset_finder_class = nil
|
36
|
+
@should_server_render = true
|
35
37
|
end
|
36
38
|
end
|
37
39
|
end
|
data/lib/js_render/renderer.rb
CHANGED
data/lib/js_render/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: js_render
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Lehman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|