ember-handlebars-template 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/README.md +16 -8
- data/ember-handlebars-template.gemspec +1 -0
- data/lib/ember/handlebars/config.rb +2 -0
- data/lib/ember/handlebars/helper.rb +3 -5
- data/lib/ember/handlebars/template.rb +9 -5
- data/lib/ember/handlebars/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18e4e96c2704e2d98f3266ca09d8adfbe5221e4a
|
4
|
+
data.tar.gz: a7a36a43f26f7ce2003424203cc95631b346d3f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21afa1657785640b5650e05751c26b53aec073775034ca8d157f570193b3838f6cd78b52bcefb7881523e99635f357adecb6e0ade925b997b53254fe22dd6bd7
|
7
|
+
data.tar.gz: ad621626fe61bfbe3c43414c148abacc004396c1d5db8d6eb5ddb8c25b51c155f7b812359d24a9b00661f8daf3948bc028c09f182d4a0a91b6e58bca636f3986
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -28,49 +28,57 @@ $ gem install ember-handlebars-template
|
|
28
28
|
Sprockets.register_engine '.hbs', Ember::Handlebars::Template # or other extension which you like.
|
29
29
|
```
|
30
30
|
|
31
|
+
It can also compile "raw" templates – pure Handlebars templates, independent of Ember. They need to have a suffix `.raw.hbs` (the last extension depends on what was registered with `register_engine`).
|
32
|
+
|
31
33
|
## Options
|
32
34
|
|
33
|
-
You can overwrite config
|
35
|
+
You can overwrite config like this:
|
34
36
|
|
35
37
|
``` ruby
|
36
38
|
Ember::Handlebars::Template.configure do |config|
|
37
39
|
config.precompile = true
|
38
40
|
|
39
|
-
#
|
41
|
+
# Or any of the options below.
|
40
42
|
end
|
41
43
|
```
|
42
44
|
|
43
|
-
### precompile
|
45
|
+
### `precompile`
|
44
46
|
|
45
47
|
Type: `Boolean`
|
46
48
|
|
47
49
|
Enables or disables precompilation.(default: `true`)
|
48
50
|
|
49
|
-
### ember_template
|
51
|
+
### `ember_template`
|
50
52
|
|
51
53
|
Type: `String`
|
52
54
|
|
53
55
|
Default which Ember template type to compile. `HTMLBars` / `Handlebars`. (default: `HTMLBars`)
|
54
56
|
|
55
|
-
### output_type
|
57
|
+
### `output_type`
|
56
58
|
|
57
59
|
Type: `Symbol`
|
58
60
|
|
59
61
|
Configures the style of output. `:global` / `:amd`. (default `:global`)
|
60
62
|
|
61
|
-
### amd_namespace
|
63
|
+
### `amd_namespace`
|
62
64
|
|
63
65
|
Type: `String`
|
64
66
|
|
65
67
|
Configures the module prefix for AMD formatted output. (default: `nil`)
|
66
68
|
|
67
|
-
###
|
69
|
+
### `raw_template_namespace`
|
70
|
+
|
71
|
+
Type: `String`
|
72
|
+
|
73
|
+
Configures the namespace that the raw templates are assigned to. (default: `JST`)
|
74
|
+
|
75
|
+
### `templates_root`
|
68
76
|
|
69
77
|
Type: `String`
|
70
78
|
|
71
79
|
Sets the root path for templates to be looked up in. (default: `templates`)
|
72
80
|
|
73
|
-
### templates_path_separator
|
81
|
+
### `templates_path_separator`
|
74
82
|
|
75
83
|
Type: `String`
|
76
84
|
|
@@ -5,6 +5,7 @@ module Ember
|
|
5
5
|
:ember_template,
|
6
6
|
:output_type,
|
7
7
|
:amd_namespace,
|
8
|
+
:raw_template_namespace,
|
8
9
|
:templates_root,
|
9
10
|
:templates_path_separator
|
10
11
|
|
@@ -13,6 +14,7 @@ module Ember
|
|
13
14
|
self.ember_template = 'HTMLBars'
|
14
15
|
self.output_type = :global
|
15
16
|
self.amd_namespace = nil
|
17
|
+
self.raw_template_namespace = 'JST'
|
16
18
|
self.templates_root = 'templates'
|
17
19
|
self.templates_path_separator = '/'
|
18
20
|
end
|
@@ -29,8 +29,8 @@ module Ember
|
|
29
29
|
[namespace, module_name].compact.join('/')
|
30
30
|
end
|
31
31
|
|
32
|
-
def global_template_target(module_name, config)
|
33
|
-
"
|
32
|
+
def global_template_target(namespace, module_name, config)
|
33
|
+
"#{namespace}[#{template_path(module_name, config).inspect}]"
|
34
34
|
end
|
35
35
|
|
36
36
|
def template_path(path, config)
|
@@ -42,9 +42,7 @@ module Ember
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
path
|
46
|
-
|
47
|
-
path.join(config.templates_path_separator)
|
45
|
+
path.split('/').join(config.templates_path_separator)
|
48
46
|
end
|
49
47
|
|
50
48
|
def compile_handlebars(string)
|
@@ -20,9 +20,12 @@ module Ember
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def setup(env)
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
%w(.raw.hbs .raw.hjs .raw.handlebars
|
24
|
+
.hbs .hjs .handlebars).each do |extension|
|
25
|
+
env.register_engine extension,
|
26
|
+
self,
|
27
|
+
mime_type: 'application/javascript'
|
28
|
+
end
|
26
29
|
end
|
27
30
|
|
28
31
|
def instance
|
@@ -72,7 +75,7 @@ module Ember
|
|
72
75
|
|
73
76
|
if config.precompile
|
74
77
|
if raw
|
75
|
-
template = precompile_handlebars(template)
|
78
|
+
template = precompile_handlebars(template, input)
|
76
79
|
else
|
77
80
|
template = precompile_ember_handlebars(template, config.ember_template, input, meta)
|
78
81
|
end
|
@@ -88,7 +91,8 @@ module Ember
|
|
88
91
|
when :amd
|
89
92
|
"define('#{module_name}', ['exports'], function(__exports__){ __exports__['default'] = #{template} });"
|
90
93
|
when :global
|
91
|
-
|
94
|
+
namespace = raw ? config.raw_template_namespace : 'Ember.TEMPLATES'
|
95
|
+
target = global_template_target(namespace, template_name, config)
|
92
96
|
|
93
97
|
"#{target} = #{template}\n"
|
94
98
|
else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ember-handlebars-template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryunosuke SATO
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sprockets
|
@@ -72,6 +72,20 @@ dependencies:
|
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '10.0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: handlebars-source
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
75
89
|
- !ruby/object:Gem::Dependency
|
76
90
|
name: minitest
|
77
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
140
|
version: '0'
|
127
141
|
requirements: []
|
128
142
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.5.
|
143
|
+
rubygems_version: 2.5.1
|
130
144
|
signing_key:
|
131
145
|
specification_version: 4
|
132
146
|
summary: The sprockets template for Ember Handlebars.
|