This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'config/path_helpers' | |
| require 'config/haml_helpers' | |
| Middleman::Base.mime :php, "text/html" | |
| set :index_file, "index.php" | |
| set :images_dir, "assets/images" | |
| set :css_dir, "assets/stylesheets" | |
| set :videos_dir, "assets/videos" | |
| set :js_dir, "assets/javascripts" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def find_and_include_related_sass_file | |
| path = request.path_info.dup | |
| path << self.class.index_file if path.match(%r{/$}) | |
| path.gsub!(%r{^/}, '') | |
| path.gsub!(File.extname(path), '') | |
| path.gsub!('/', '-') | |
| sass_file = File.join(File.basename(self.class.views), self.class.css_dir, "#{path}.css.sass") | |
| if File.exists? sass_file | |
| stylesheet_link_tag "#{path}.css" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def partial(name) | |
| haml name.to_sym, :layout => false | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %pre | |
| :preserve | |
| Text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| :table | |
| Col1 | Col2 | Col3 | |
| 5 | 6 | 7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| get "/layoutless_page" do | |
| haml :"layoutless_page.html", :layout => false | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #header { | |
| height: 108px; | |
| overflow: hidden; | |
| background: #6B4419; | |
| background: #6B4419 -webkit-gradient(linear, 0 bottom, 0 98, from(rgba(0,0,0,0.1)), to(transparent)); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Sinatra::Base | |
| # not my code | |
| def self.get(url, *args) | |
| # method body | |
| end | |
| # my code | |
| def self.with_layout(url, layout, &block) | |
| # Basically, I want to call get, but with additional args appended | |
| Generic.class_eval(&block) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Normal Sinatra version | |
| get "/index.html" do | |
| haml :index | |
| end | |
| # Proposed API | |
| with_layout :custom do | |
| get "/using-custom.html" | |
| get "/admin-area/index.html" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| In your init.rb | |
| This: | |
| with_layout :admin do | |
| page "/admin/*" | |
| end | |
| Or: |