sprockets-coffee-react 2.4.1 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.rdoc +36 -2
- data/lib/sprockets/coffee-react/engine.rb +3 -1
- data/lib/sprockets/coffee-react.rb +5 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1df07468e1e001c592a22e4b07b22e23a5df5dc
|
4
|
+
data.tar.gz: edc0f4812b388d1b6c39c95e4ca378fd0a61cc2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b10ba3f10c46f3f7b5c660cdc798bbbe13dcf1221d718ae08befcb4d81893fe3838ffe2bb0df7e0797c12c32b1a7c8e011f9e25ba978eee9123dd27dfa41c4b2
|
7
|
+
data.tar.gz: aa06502345a2e77e28f5891216196826b6e842119d00f571ebf0b055f03f08f101b4afb50642275d2ab05f0a3ca88eab298193dfea7f4442abd1ef1a2834e018
|
data/README.rdoc
CHANGED
@@ -11,8 +11,8 @@ Add this to your Gemfile:
|
|
11
11
|
|
12
12
|
gem 'sprockets-coffee-react'
|
13
13
|
|
14
|
-
Place a <tt>.js.coffee.cjsx</tt> or <tt>.js.cjsx</tt> file
|
15
|
-
|
14
|
+
Place a <tt>.js.coffee.cjsx</tt> or <tt>.js.cjsx</tt> file, or a <tt>.js.coffee</tt>
|
15
|
+
file in your assets directory. When you require it into other JS files the CJSX
|
16
16
|
markup will be transformed and compiled to Javascript.
|
17
17
|
|
18
18
|
Eg. if you have a file called <tt>my-component.js.coffee</tt> which contains
|
@@ -20,8 +20,42 @@ some CJSX code, require it from <tt>application.js</tt> or somewhere else:
|
|
20
20
|
|
21
21
|
//= require my-component
|
22
22
|
|
23
|
+
== How to use with a Rack application
|
23
24
|
|
25
|
+
If you're not using rails, you'll need to register the Sprockets preprocessor manually. Here is an
|
26
|
+
adapted version of the Rack example provided by Sprockets, which additionally requires and registers
|
27
|
+
the sprockets-coffee-react engine:
|
28
|
+
|
29
|
+
require 'sprockets'
|
30
|
+
require 'sprockets/coffee-react'
|
31
|
+
map '/assets' do
|
32
|
+
environment = Sprockets::Environment.new
|
33
|
+
environment.append_path 'app/assets/javascripts'
|
34
|
+
environment.append_path 'app/assets/stylesheets'
|
35
|
+
environment.register_preprocessor 'application/javascript', Sprockets::CoffeeReact
|
36
|
+
environment.register_engine '.cjsx', Sprockets::CoffeeReactScript
|
37
|
+
environment.register_engine '.js.cjsx', Sprockets::CoffeeReactScript
|
38
|
+
run environment
|
39
|
+
end
|
40
|
+
|
41
|
+
map '/' do
|
42
|
+
run YourRackApp
|
43
|
+
end
|
24
44
|
|
25
45
|
== License
|
26
46
|
|
27
47
|
Released under the MIT License. See the LICENSE file for further details.
|
48
|
+
|
49
|
+
== How to use with Middleman
|
50
|
+
|
51
|
+
Add the following to your config.rb file:
|
52
|
+
|
53
|
+
require 'sprockets/coffee-react'
|
54
|
+
|
55
|
+
::Sprockets.register_preprocessor 'application/javascript', ::Sprockets::CoffeeReact
|
56
|
+
::Sprockets.register_engine '.cjsx', ::Sprockets::CoffeeReactScript
|
57
|
+
::Sprockets.register_engine '.js.cjsx', ::Sprockets::CoffeeReactScript
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
@@ -6,7 +6,8 @@ if defined?(Rails)
|
|
6
6
|
class CoffeeReact
|
7
7
|
class Engine < ::Rails::Engine
|
8
8
|
initializer :setup_coffee_react, :after => "sprockets.environment", :group => :all do |app|
|
9
|
-
|
9
|
+
|
10
|
+
# ::Sprockets::CoffeeReact.install(app.assets)
|
10
11
|
|
11
12
|
# unless app.assets.engines['.coffee']
|
12
13
|
# if defined?(Sprockets::CoffeeScriptTemplate)
|
@@ -17,6 +18,7 @@ if defined?(Rails)
|
|
17
18
|
# end
|
18
19
|
|
19
20
|
# app.assets.register_preprocessor '.coffee', Sprockets::CoffeeReact
|
21
|
+
app.assets.register_preprocessor 'application/javascript', Sprockets::CoffeeReact
|
20
22
|
app.assets.register_engine '.cjsx', Sprockets::CoffeeReactScript
|
21
23
|
app.assets.register_engine '.js.cjsx', Sprockets::CoffeeReactScript
|
22
24
|
end
|
@@ -19,5 +19,10 @@ module Sprockets
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
def self.install(environment = ::Sprockets)
|
23
|
+
environment.register_preprocessor 'application/javascript', Sprockets::CoffeeReact
|
24
|
+
environment.register_engine '.cjsx', Sprockets::CoffeeReactScript
|
25
|
+
environment.register_engine '.js.cjsx', Sprockets::CoffeeReactScript
|
26
|
+
end
|
22
27
|
end
|
23
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sprockets-coffee-react
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Friend
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coffee-react
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 3.0.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 3.0.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: coffee-script
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|