Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit bbaabab

Browse files
committed
Add react/react-source
Usage: 1) In Ruby file, require `react/react-source` 2) In Opal file, require `react/react-source` before requiring reactrb
1 parent 4e5d1fb commit bbaabab

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
// A placeholder file to prevent file not found error of requireing
2-
// `react-server` in spec_helper.rb.
2+
// `react-server` in react/react-source

lib/react/react-source.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
if RUBY_ENGINE == 'opal'
2+
require 'react.js'
3+
require "react-server.js"
4+
else
5+
require "react/rails/asset_variant"
6+
react_directory = React::Rails::AssetVariant.new(addons: true).react_directory
7+
Opal.append_path react_directory.untaint
8+
Opal.append_path File.expand_path('../../react-sources/', __FILE__).untaint
9+
end

0 commit comments

Comments
 (0)