Advertisement
Guest User

Untitled

a guest
Jun 25th, 2014
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.63 KB | None | 0 0
  1. route '*' do
  2.   path = item.identifier.dup
  3.   path.gsub!('_', '-')  # replace '_' by '-' (better SEO)
  4.   path.downcase!        # convert to lowercase
  5.  
  6.   if item.binary?
  7.     # /foo/ -> /foo.ext
  8.     if item[:extension]
  9.       item[:extension].nil? || (item[:content_filename].nil? && path =~ %r{#{item[:extension]}/$}) ? path.chop! : path.chop! + '.' + item[:extension]
  10.     else
  11.       path
  12.     end
  13.   else
  14.     case item[:extension]
  15.       when 'css', 'scss'
  16.         path.chop! + '.css'
  17.       when 'js'
  18.         path.chop! + '.js'
  19.       else
  20.         item.identifier == '/' ? '/index.html' : path.chop! + '.html'
  21.     end
  22.   end
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement