Class: SC::Builder::Handlebars
- Inherits:
-
Base
show all
- Defined in:
- lib/sproutcore/builders/handlebars.rb
Instance Attribute Summary
Attributes inherited from Base
#entry
Instance Method Summary
collapse
Methods inherited from Base
build, #initialize, #joinlines, #read, #readlines, #replace_static_url, #writeline, #writelinebinary, #writelines
Instance Method Details
#build(dst_path) ⇒ Object
15
16
17
18
19
20
|
# File 'lib/sproutcore/builders/handlebars.rb', line 15
def build(dst_path)
template_name = entry.rootname[/^.*\/([^\/]*)$/, 1]
template_code = read(entry[:source_path])
replace_static_url(template_code)
writelines dst_path, "SC.TEMPLATES[#{template_name.inspect}] = SC.Handlebars.compile(#{template_code.to_json});"
end
|
#sc_static_match ⇒ Object
22
23
24
|
# File 'lib/sproutcore/builders/handlebars.rb', line 22
def sc_static_match
/\{\{(sc_static|static_url|sc_target)\(\s*['"]([^"']*?)['"]\s*\)\}\}/
end
|
#static_url(url = '') ⇒ Object
26
27
28
|
# File 'lib/sproutcore/builders/handlebars.rb', line 26
def static_url(url='')
url
end
|