module EvilFront

Constants

HTML_ESCAPE
VERSION

Public Class Methods

escape(string) click to toggle source

Escape unsafe strings

# File lib/evil-front/helpers.rb, line 14
def self.escape(string)
  string = string.to_s
  if not string.respond_to?(:html_safe?) or string.html_safe?
    string
  else
    string.gsub(/[&><]/, HTML_ESCAPE).html_safe
  end
end
html_safe(string) click to toggle source

Call `html_safe` if String has this methods.

# File lib/evil-front/helpers.rb, line 5
def self.html_safe(string)
  if string.respond_to?(:html_safe)
    string.html_safe
  else
    string.to_s
  end
end
install(sprockets) click to toggle source

Install Evil Front to standalone Sprockets environment.

# File lib/evil-front.rb, line 20
def self.install(sprockets)
  RailsSassImages.install(sprockets)

  root = Pathname(__FILE__).dirname.join('..')
  sprockets.append_path(root.join('lib/assets/javascripts'))
  sprockets.append_path(root.join('lib/assets/stylesheets'))
  sprockets.append_path(root.join('vendor/assets/fonts'))
end
set_slim_options!() click to toggle source

Set default options to Slim

# File lib/evil-front/slim.rb, line 3
def self.set_slim_options!
  Slim::Engine.set_options(pretty: true, format: :html)
end