0.0
No commit activity in last 3 years
No release in over 3 years
Repres (REsource PRESentation) is a series of resource presentation engines. The React resource presentation engine includes React-based resource presentation templates & snippets. Repres (资源表现)是一系列的资源表现引擎。React 资源表现引擎包括基于React的资源表现模版和片段。
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Repres React React资源表现引擎

Documentation License

Gem Version Dependency Status

Repres (REsource PRESentation) is a series of resource presentation engines. The React resource presentation engine includes React-based resource presentation templates & snippets. Repres (资源表现)是一系列的资源表现引擎。React 资源表现引擎包括基于React的资源表现模版和片段。

Recent Update

Check out the Road Map to find out what's the next. Check out the Change Log to find out what's new.

Usage in Gemfile

gem 'repres-react'

Include the Helper in your Application Controller before Render the Script with the helper methods

helper Repres::React::ApplicationHelper

Render the Pre-defined Partials

Render the Script

The Script partial includes the HTML script tags for React and its extensions. The Boot CDN server is supported by default. However, the :cdn option could be passed in to support other CDN servers. The CDN servers must syncrhonize with cdnjs.

The following code snippet does not load any JavaScript library.

<%= render partial: 'repres/react/script' %>
<!-- or the following line works identically -->
<%= react_script %>

The following code snippet loads the latest React JavaScript library.

<%= render partial: 'repres/bootstrap/script', locals: { options: { react: true, 'react-dom': true } } %>
<!-- or the following line works identically -->
<%= react_script react: true, 'react-dom': true %>

The following code snippet loads the React JavaScript library with the given version.

<%= render partial: 'repres/bootstrap/script', locals: { options: { react: { version: '15.0.2', cdn: 'cdn.server.com' }, 'react-dom': { version: '15.0.2' } } } %>
<!-- or the following line works identically -->
<%= react_script react: { version: '15.0.2', cdn: 'cdn.server.com' }, 'react-dom': { version: '15.0.2' } %>

The following JavaScript libraries are switchable, and the version can be configurable:

  • :react
  • :'react-dom'
  • :redux

RSpec examples

# spec/models/repres_spec.rb
require 'repres/react/models_rspec'

# spec/types/repres_spec.rb
require 'repres/react/types_rspec'

# spec/validators/repres_spec.rb
require 'repres/react/validators_rspec'