Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- route '*' do
- path = item.identifier.dup
- path.gsub!('_', '-') # replace '_' by '-' (better SEO)
- path.downcase! # convert to lowercase
- if item.binary?
- # /foo/ -> /foo.ext
- if item[:extension]
- item[:extension].nil? || (item[:content_filename].nil? && path =~ %r{#{item[:extension]}/$}) ? path.chop! : path.chop! + '.' + item[:extension]
- else
- path
- end
- else
- case item[:extension]
- when 'css', 'scss'
- path.chop! + '.css'
- when 'js'
- path.chop! + '.js'
- else
- item.identifier == '/' ? '/index.html' : path.chop! + '.html'
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement