Sha256: 6d2bc512b4ca3f4dca0e2f25cf6b1d375ae60acd254fc19475df241236a1349e

Contents?: true

Size: 1.04 KB

Versions: 18

Compression:

Stored size: 1.04 KB

Contents

module React
  module Rails
    # 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.
    class AssetVariant
      GEM_ROOT = Pathname.new('../../../../').expand_path(__FILE__)
      # @return [String] "production" or "development"
      attr_reader :react_build

      # @return [String] The path which contains the specified React.js build as "react.js"
      attr_reader :react_directory

      # @return [String] The path which contains the JSX Transformer
      attr_reader :jsx_directory

      # @param [Hash] Options for the asset variant
      # @option variant [Symbol] if `:production`, use the minified React.js build
      def initialize(options={})

        @react_build = options[:variant] == :production ? 'production' : 'development'

        @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
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
react-rails-2.7.1 lib/react/rails/asset_variant.rb
react-rails-2.7.0 lib/react/rails/asset_variant.rb
react-rails-2.7.0.rc.2 lib/react/rails/asset_variant.rb
react-rails-2.7.0.rc.1 lib/react/rails/asset_variant.rb
react-rails-2.7.0.rc.0 lib/react/rails/asset_variant.rb
react-rails-2.6.2 lib/react/rails/asset_variant.rb
react-rails-2.6.1 lib/react/rails/asset_variant.rb
react-rails-2.6.0 lib/react/rails/asset_variant.rb
react-rails-2.5.0 lib/react/rails/asset_variant.rb
react-rails-2.4.7 lib/react/rails/asset_variant.rb
react-rails-2.4.6 lib/react/rails/asset_variant.rb
react-rails-2.4.5 lib/react/rails/asset_variant.rb
react-rails-2.4.4 lib/react/rails/asset_variant.rb
react-rails-2.4.4.pre lib/react/rails/asset_variant.rb
react-rails-2.4.3 lib/react/rails/asset_variant.rb
react-rails-2.4.2 lib/react/rails/asset_variant.rb
react-rails-2.4.1 lib/react/rails/asset_variant.rb
react-rails-2.4.0 lib/react/rails/asset_variant.rb