Class: React::Rails::AssetVariant
- Inherits:
-
Object
- Object
- React::Rails::AssetVariant
- Defined in:
- lib/react/rails/asset_variant.rb
Overview
This class accepts some options for which build you want, then exposes where you can find them. In general, these paths should be added to the sprockets environment.
Constant Summary collapse
- GEM_ROOT =
Pathname.new('../../../../').(__FILE__)
Instance Attribute Summary collapse
-
#jsx_directory ⇒ String
readonly
The path which contains the JSX Transformer.
-
#react_build ⇒ String
readonly
“production” or “development”.
-
#react_directory ⇒ String
readonly
The path which contains the specified React.js build as “react.js”.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ AssetVariant
constructor
A new instance of AssetVariant.
Constructor Details
#initialize(options = {}) ⇒ AssetVariant
Returns a new instance of AssetVariant.
19 20 21 22 23 24 25 26 |
# File 'lib/react/rails/asset_variant.rb', line 19 def initialize(={}) @react_build = [:variant] == :production ? 'production' : 'development' [:addons] && @react_build += '-with-addons' @react_directory = GEM_ROOT.join('lib/assets/react-source/').join(@react_build).to_s @jsx_directory = GEM_ROOT.join('lib/assets/javascripts/').to_s end |
Instance Attribute Details
#jsx_directory ⇒ String (readonly)
Returns The path which contains the JSX Transformer.
14 15 16 |
# File 'lib/react/rails/asset_variant.rb', line 14 def jsx_directory @jsx_directory end |
#react_build ⇒ String (readonly)
Returns “production” or “development”.
8 9 10 |
# File 'lib/react/rails/asset_variant.rb', line 8 def react_build @react_build end |
#react_directory ⇒ String (readonly)
Returns The path which contains the specified React.js build as “react.js”.
11 12 13 |
# File 'lib/react/rails/asset_variant.rb', line 11 def react_directory @react_directory end |