templebars 0.0.3 → 0.0.4
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.
@@ -7,8 +7,6 @@ module Templebars
|
|
7
7
|
# Tilt template renderer for precompiling Handlebars templates and storing
|
8
8
|
# them in a global Templates object.
|
9
9
|
class HandlebarsTemplate < ::Tilt::Template
|
10
|
-
SETUP_GLOBAL = "('undefined' == typeof #{Templebars::Rails::GLOBAL}) && (#{Templebars::Rails::GLOBAL} = {})"
|
11
|
-
|
12
10
|
def self.default_mime_type
|
13
11
|
"application/javascript"
|
14
12
|
end
|
@@ -18,10 +16,12 @@ module Templebars
|
|
18
16
|
def prepare; end
|
19
17
|
|
20
18
|
def evaluate( scope, locals, &block )
|
19
|
+
global = Templebars::Rails::GLOBAL
|
20
|
+
setup_global = "('undefined' == typeof #{global}) && (#{global} = {})"
|
21
21
|
name = scope.logical_path.sub( /^templates\//, "" )
|
22
22
|
precompiled_js = precompile( data )
|
23
|
-
template_declaration = "#{
|
24
|
-
"#{
|
23
|
+
template_declaration = "#{global}[\"#{name}\"] = Handlebars.template(#{precompiled_js});"
|
24
|
+
"#{setup_global}\n#{template_declaration}\n"
|
25
25
|
end
|
26
26
|
|
27
27
|
protected
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: templebars
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-01-13 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
16
|
-
requirement: &
|
16
|
+
requirement: &70364819080120 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -24,10 +24,10 @@ dependencies:
|
|
24
24
|
version: '5.0'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
|
-
version_requirements: *
|
27
|
+
version_requirements: *70364819080120
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: execjs
|
30
|
-
requirement: &
|
30
|
+
requirement: &70364819079440 !ruby/object:Gem::Requirement
|
31
31
|
none: false
|
32
32
|
requirements:
|
33
33
|
- - ! '>='
|
@@ -35,7 +35,7 @@ dependencies:
|
|
35
35
|
version: '0'
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
|
-
version_requirements: *
|
38
|
+
version_requirements: *70364819079440
|
39
39
|
description: This gem provides Handlebars magic for your Rails 3 application.
|
40
40
|
email:
|
41
41
|
- tyson@stovepipestudios.com
|