Remove ugly option from non-core files / docs
This commit is contained in:
parent
fccae5a9c2
commit
9b96ff34a1
13
FAQ.md
13
FAQ.md
|
@ -2,19 +2,6 @@
|
|||
|
||||
## Haml
|
||||
|
||||
### Why is my markup indented properly in development mode, but not in production? {#q-indentation-in-production}
|
||||
|
||||
To improve performance, Haml defaults to {Haml::Options#ugly "ugly" mode} in
|
||||
Rails apps running in production. Ugly mode is when whitespace is stripped out,
|
||||
and this *can* cause issues occasionally.
|
||||
|
||||
If you are using Rails, you can change the default behaviour by creating a config/initializers/haml.rb file and
|
||||
adding in the following line.
|
||||
|
||||
Haml::Template.options[:ugly] = true
|
||||
|
||||
Or, you can pass in false, if you want your production mode to run all pretty like.
|
||||
|
||||
### How do I put a punctuation mark after an element, like "`I like <strong>cake</strong>!`"? {#q-punctuation}
|
||||
|
||||
Expressing the structure of a document
|
||||
|
|
2
Rakefile
2
Rakefile
|
@ -77,7 +77,7 @@ task :profile do
|
|||
require 'haml'
|
||||
file = File.read(File.expand_path("../#{file}", __FILE__))
|
||||
obj = Object.new
|
||||
Haml::Engine.new(file, :ugly => true).def_method(obj, :render)
|
||||
Haml::Engine.new(file).def_method(obj, :render)
|
||||
result = RubyProf.profile { times.times { obj.render } }
|
||||
|
||||
RubyProf.const_get("#{(ENV['OUTPUT'] || 'Flat').capitalize}Printer").new(result).print
|
||||
|
|
2
TODO
2
TODO
|
@ -15,7 +15,7 @@
|
|||
Speed
|
||||
Make tags with dynamic attributes pre-render as much as possible
|
||||
Including the attribute name where doable
|
||||
:ugly + :html improvements
|
||||
:html improvements
|
||||
Ignore closing tags where we can
|
||||
http://code.google.com/speed/articles/optimizing-html.html
|
||||
Requires Haml parsing refactor
|
||||
|
|
14
benchmark.rb
14
benchmark.rb
|
@ -27,7 +27,6 @@ end
|
|||
|
||||
RBench.run(times) do
|
||||
column :haml, :title => "Haml"
|
||||
column :haml_ugly, :title => "Haml :ugly"
|
||||
column :erb, :title => "ERB"
|
||||
column :erubis, :title => "Erubis"
|
||||
|
||||
|
@ -39,42 +38,29 @@ RBench.run(times) do
|
|||
obj = Object.new
|
||||
|
||||
Haml::Engine.new(haml_template).def_method(obj, :haml)
|
||||
Haml::Engine.new(haml_template, :ugly => true).def_method(obj, :haml_ugly)
|
||||
Erubis::Eruby.new(erb_template).def_method(obj, :erubis)
|
||||
obj.instance_eval("def erb; #{ERB.new(erb_template, nil, '-').src}; end")
|
||||
|
||||
haml { obj.haml }
|
||||
haml_ugly { obj.haml_ugly }
|
||||
erb { obj.erb }
|
||||
erubis { obj.erubis }
|
||||
end
|
||||
|
||||
report "ActionView" do
|
||||
|
||||
Haml::Template.options[:ugly] = false
|
||||
# To cache the template
|
||||
render view, 'templates/standard'
|
||||
render view, 'erb/standard'
|
||||
|
||||
haml { render view, 'templates/standard' }
|
||||
erb { render view, 'erb/standard' }
|
||||
|
||||
Haml::Template.options[:ugly] = true
|
||||
render view, 'templates/standard_ugly'
|
||||
haml_ugly { render view, 'templates/standard_ugly' }
|
||||
end
|
||||
|
||||
report "ActionView with deep partials" do
|
||||
Haml::Template.options[:ugly] = false
|
||||
# To cache the template
|
||||
render view, 'templates/action_view'
|
||||
render view, 'erb/action_view'
|
||||
|
||||
haml { render view, 'templates/action_view' }
|
||||
erb { render view, 'erb/action_view' }
|
||||
|
||||
Haml::Template.options[:ugly] = true
|
||||
render view, 'templates/action_view_ugly'
|
||||
haml_ugly { render view, 'templates/action_view_ugly' }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue