middleman-react 0.12.1 → 0.12.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +15 -0
- data/Rakefile +6 -0
- data/lib/middleman-react/extension.rb +8 -0
- data/lib/middleman-react/jsx.rb +2 -2
- data/lib/middleman-react/jsx/template.rb +14 -2
- data/lib/middleman-react/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa7fba70a39d5400507265dea99855e7ff55d7b8
|
4
|
+
data.tar.gz: 4b8c05c8e511275349741723b93ea603cf9693b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4578d9f957b041a42559259e588d3be162517b7390753c02233c768b62a7a7c400329fca44bb9febc4671beef25fb477ce5b5a5fb11795e1855203557711b480
|
7
|
+
data.tar.gz: 5060eecb38cd96a3edcbf783664bc79e525a54a6d4cbbe3a393ef061633437c62cfaad0ab9e404e31f8134a86c61236521e18d89463eb827890bddfad5fdca83
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -9,6 +9,16 @@ Inspired (and pretty much a clone of really) the [react-rails] gem for Middleman
|
|
9
9
|
1. `gem install middleman-react`
|
10
10
|
2. `activate :react` in `config.rb`
|
11
11
|
|
12
|
+
##### Options
|
13
|
+
|
14
|
+
It is also possible to pass options through to the JSX compiler if that’s your thing:
|
15
|
+
|
16
|
+
``` ruby
|
17
|
+
activate :react do |config|
|
18
|
+
config.harmony = true
|
19
|
+
config.strip_types = true
|
20
|
+
end
|
21
|
+
```
|
12
22
|
|
13
23
|
#### Sprockets loading react-source
|
14
24
|
|
@@ -32,6 +42,11 @@ Or with addons:
|
|
32
42
|
//= require react-with-addons
|
33
43
|
```
|
34
44
|
|
45
|
+
#### A note on versioning
|
46
|
+
|
47
|
+
The version for this gem will reflect that of the underlying version of `react-source`, meaning that using `0.12.1` of this gem will give you version `0.12.1` of React. This is the same approach that `react-rails` takes.
|
48
|
+
If updates to the gem code are required that do not alter the `react-source` version in use need to be made they will be released with a `.1` version appended, eg: `0.12.1.1`.
|
49
|
+
|
35
50
|
#### Developing / Contributing
|
36
51
|
1. Fork it!
|
37
52
|
2. Get set up: `./script/bootstrap`
|
data/Rakefile
ADDED
@@ -8,7 +8,15 @@ module Middleman
|
|
8
8
|
module React
|
9
9
|
# Middleman extension entry point
|
10
10
|
class Extension < Middleman::Extension
|
11
|
+
option :harmony, false, 'The option of harmony'
|
12
|
+
option :strip_types, false, 'The option of stripTypes'
|
13
|
+
|
11
14
|
def initialize(app, options_hash = {}, &block)
|
15
|
+
super
|
16
|
+
|
17
|
+
Middleman::React::Template.harmony = options[:harmony]
|
18
|
+
Middleman::React::Template.strip_types = options[:strip_types]
|
19
|
+
|
12
20
|
::Tilt.register 'jsx', Middleman::React::Template
|
13
21
|
::Sprockets.register_engine 'jsx', Middleman::React::Template
|
14
22
|
end
|
data/lib/middleman-react/jsx.rb
CHANGED
@@ -16,8 +16,8 @@ module Middleman
|
|
16
16
|
@context ||= ExecJS.compile(contents)
|
17
17
|
end
|
18
18
|
|
19
|
-
def transform(code)
|
20
|
-
context.call('JSXTransformer.transform', code)['code']
|
19
|
+
def transform(code, opts = {})
|
20
|
+
context.call('JSXTransformer.transform', code, opts)['code']
|
21
21
|
end
|
22
22
|
module_function :transform
|
23
23
|
end
|
@@ -8,10 +8,22 @@ module Middleman
|
|
8
8
|
class Template < Tilt::Template
|
9
9
|
self.default_mime_type = 'application/javascript'
|
10
10
|
|
11
|
-
|
11
|
+
cattr_accessor :harmony
|
12
|
+
cattr_accessor :strip_types
|
13
|
+
@harmony = false
|
14
|
+
@strip_types = false
|
15
|
+
|
16
|
+
def prepare
|
17
|
+
if self.class.harmony || options.key?(:harmony)
|
18
|
+
options[:harmony] = self.class.harmony
|
19
|
+
end
|
20
|
+
if self.class.strip_types || options.key?(:stripTypes)
|
21
|
+
options[:stripTypes] = self.class.strip_types
|
22
|
+
end
|
23
|
+
end
|
12
24
|
|
13
25
|
def evaluate(scope, locals, &block)
|
14
|
-
@output ||= JSX.transform(data)
|
26
|
+
@output ||= JSX.transform(data, options)
|
15
27
|
end
|
16
28
|
end
|
17
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-react
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.1
|
4
|
+
version: 0.12.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Morris
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: middleman-core
|
@@ -177,6 +177,7 @@ files:
|
|
177
177
|
- Gemfile.lock
|
178
178
|
- LICENSE
|
179
179
|
- README.md
|
180
|
+
- Rakefile
|
180
181
|
- fixtures/app/config.rb
|
181
182
|
- fixtures/app/source/assets/javascripts/coffeescript.js.jsx.coffee
|
182
183
|
- fixtures/app/source/assets/javascripts/plain_jsx.js.jsx
|