smt_rails 0.2.9 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/README.md +7 -7
- data/lib/smt_rails/engine.rb +6 -1
- data/lib/smt_rails/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d890287cb5c00f5e578f630d59b96c898d6f219
|
4
|
+
data.tar.gz: 7a385c39cb00db68cc19ad6d08afb96d77d58837
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19124d99e48b714ebd5d30d4b3aac0b8c92caf11df43de8126a2973cdd5589643a4460ae764711646f4e78e44342344a93a1deb68c404b1559630deeef144e37
|
7
|
+
data.tar.gz: e235d6c7f5d59ab727aa1ea323f339fdf157043e8352b744e02f3b432b1e74f033367c1d7b358ecfc12a13670ed60667e9cae255b614ea0090be8f3dbf0567a7
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.3
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SmtRails
|
2
2
|
|
3
|
-
Shared mustache templates for
|
3
|
+
Shared mustache templates for Rails 3 and 4 and Sprockets 2 and 3.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -11,15 +11,15 @@ Add this line to your application's Gemfile:
|
|
11
11
|
And then execute:
|
12
12
|
|
13
13
|
$ bundle
|
14
|
-
|
14
|
+
|
15
15
|
Or install it yourself as:
|
16
|
-
|
16
|
+
|
17
17
|
$ gem install smt_rails
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
21
|
$ rails g smt_rails:install
|
22
|
-
|
22
|
+
|
23
23
|
Generator add into "application.js" requirements for mustache and "templates" folder in "app". Next you can create mustache templates in this folder or subfolders.
|
24
24
|
|
25
25
|
For example:
|
@@ -27,11 +27,11 @@ For example:
|
|
27
27
|
File: "app/templates/tests/_test.mustache"
|
28
28
|
|
29
29
|
Hello {{msg}}!!!
|
30
|
-
|
30
|
+
|
31
31
|
In view you can render this template by this way:
|
32
32
|
|
33
|
-
<%= render "tests/test", :mustache => {msg: "Test"} %>
|
34
|
-
|
33
|
+
<%= render "tests/test", :mustache => {msg: "Test"} %>
|
34
|
+
|
35
35
|
The same template you can render in JavaScript:
|
36
36
|
|
37
37
|
var content = SMT['tests/test']({msg: "Test"});
|
data/lib/smt_rails/engine.rb
CHANGED
@@ -6,7 +6,12 @@ module SmtRails
|
|
6
6
|
|
7
7
|
initializer "sprockets.smt_rails", :group => :all do |app|
|
8
8
|
app.config.assets.configure do |env|
|
9
|
-
env.
|
9
|
+
if env.respond_to?(:register_transformer)
|
10
|
+
env.register_mime_type 'text/html', extensions: ['.mustache'], charset: :html
|
11
|
+
env.register_preprocessor 'text/html', Tilt
|
12
|
+
else
|
13
|
+
env.register_engine(".#{SmtRails.template_extension}", Tilt)
|
14
|
+
end
|
10
15
|
end
|
11
16
|
app.config.assets.paths << SmtRails.template_base_path
|
12
17
|
end
|
data/lib/smt_rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smt_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Vasiliev
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-02-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
112
|
version: '0'
|
113
113
|
requirements: []
|
114
114
|
rubyforge_project:
|
115
|
-
rubygems_version: 2.
|
115
|
+
rubygems_version: 2.5.2
|
116
116
|
signing_key:
|
117
117
|
specification_version: 4
|
118
118
|
summary: Shared mustache templates for rails 3
|