hogan_assets 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +7 -0
- data/lib/hogan_assets/config.rb +6 -1
- data/lib/hogan_assets/tilt.rb +2 -2
- data/lib/hogan_assets/version.rb +1 -1
- data/test/hogan_assets/tilt_test.rb +9 -0
- metadata +2 -2
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -57,6 +57,12 @@ And then execute:
|
|
57
57
|
|
58
58
|
$ bundle
|
59
59
|
|
60
|
+
Hamstache compilation can be configured using [Haml options](http://haml.info/docs/yardoc/Haml/Options.html). For example:
|
61
|
+
|
62
|
+
HoganAssets::Config.configure do |config|
|
63
|
+
config.haml_options[:ugly] = true
|
64
|
+
end
|
65
|
+
|
60
66
|
## Configuration
|
61
67
|
|
62
68
|
### Lambda Support
|
@@ -121,6 +127,7 @@ I made this because I <3 **mustache** and want to use it in Rails. Follow me on
|
|
121
127
|
* @gleuch (Greg Leuch) : Mustache lambdas
|
122
128
|
* @lautis (Ville Lautanala) : hamstache fix
|
123
129
|
* @adamstrickland (Adam Strickland) : Custom template namespace
|
130
|
+
* @lautis (Ville Lautanala) : haml_options configuration
|
124
131
|
|
125
132
|
## Contributing
|
126
133
|
|
data/lib/hogan_assets/config.rb
CHANGED
@@ -9,12 +9,13 @@ module HoganAssets
|
|
9
9
|
# config.lambda_support = false
|
10
10
|
# config.path_prefix = 'templates'
|
11
11
|
# config.template_extensions = ['mustache', 'hamstache']
|
12
|
+
# config.haml_options[:ugly] = true
|
12
13
|
# end
|
13
14
|
#
|
14
15
|
module Config
|
15
16
|
extend self
|
16
17
|
|
17
|
-
attr_writer :lambda_support, :path_prefix, :template_extensions, :template_namespace
|
18
|
+
attr_writer :lambda_support, :path_prefix, :template_extensions, :template_namespace, :haml_options
|
18
19
|
|
19
20
|
def configure
|
20
21
|
yield self
|
@@ -43,5 +44,9 @@ module HoganAssets
|
|
43
44
|
['mustache']
|
44
45
|
end
|
45
46
|
end
|
47
|
+
|
48
|
+
def haml_options
|
49
|
+
@haml_options ||= {}
|
50
|
+
end
|
46
51
|
end
|
47
52
|
end
|
data/lib/hogan_assets/tilt.rb
CHANGED
@@ -15,8 +15,8 @@ module HoganAssets
|
|
15
15
|
template_namespace = HoganAssets::Config.template_namespace
|
16
16
|
|
17
17
|
text = if template_path.is_hamstache?
|
18
|
-
raise "Unable to
|
19
|
-
Haml::Engine.new(data, @options).render
|
18
|
+
raise "Unable to compile #{template_path.full_path} because haml is not available. Did you add the haml gem?" unless HoganAssets::Config.haml_available?
|
19
|
+
Haml::Engine.new(data, HoganAssets::Config.haml_options.merge(@options)).render
|
20
20
|
else
|
21
21
|
data
|
22
22
|
end
|
data/lib/hogan_assets/version.rb
CHANGED
@@ -90,5 +90,14 @@ module HoganAssets
|
|
90
90
|
this.JST[\"path/to/template\"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||\"\");t.b(\"This is \");t.b(t.v(t.f(\"mustache\",c,p,0)));return t.fl(); },partials: {}, subs: { }}, "", Hogan, {});
|
91
91
|
END_EXPECTED
|
92
92
|
end
|
93
|
+
|
94
|
+
def test_haml_options
|
95
|
+
HoganAssets::Config.configure do |config|
|
96
|
+
config.haml_options[:ugly] = true
|
97
|
+
end
|
98
|
+
scope = make_scope '/myapp/app/assets/javascripts', 'path/to/template.hamstache'
|
99
|
+
template = HoganAssets::Tilt.new(scope.s_path) { "%p\n This is {{mustache}}" }
|
100
|
+
assert_match /\"This is "/, template.render(scope, {})
|
101
|
+
end
|
93
102
|
end
|
94
103
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hogan_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09
|
12
|
+
date: 2012-11-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: execjs
|