Is there a way to strip HTML whitespaces in ERB templates, using Sinatra?
The Slim engine does it out-of-the-box, but I don’t know how can ERB do the same.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Sinatra lets you create your own middleware, a possible solution (that works for me) is to create a custom class (middleware in Sinatra’s terms) and use it. The custom class uses a regexp to remove all whitespaces, respecting the content: