LoginSignup
2
2

More than 5 years have passed since last update.

sinatraでhamlが生成するコードをダブルクォーテーションで出力する

Last updated at Posted at 2015-12-24

概要

sinatra + haml のデフォルトの出力は、

<meta charset='utf-8' content='text/html' http-equiv='Content-Type'>

と、シングルクォーテーションとなっている。
これを、

<meta charset="utf-8" content="text/html" http-equiv="Content-Type">

と、ダブルクォーテーションにしたい。

解決策

コントローラ(my_app.rb)に、
以下を追加する。

class MyApp < Sinatra::Base
  set :haml, :attr_wrapper => '"'    # これを追加
  ...
end
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2