Last active
August 29, 2015 14:08
-
-
Save carlosipe/dc163297f527f77e91bb to your computer and use it in GitHub Desktop.
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
| module Helpers | |
| def javascript_tag(pathname) | |
| "<script src='#{asset_url(pathname)}'></script>" | |
| end | |
| def stylesheet_tag(pathname) | |
| "<link href='#{asset_url(pathname)}' rel='stylesheet'>" | |
| end | |
| private | |
| def asset_url(pathname) | |
| dir = File.dirname(pathname) | |
| ext = File.extname(pathname) | |
| basename = File.basename(pathname, ext) | |
| time = File.mtime(File.join(PUBLIC_PATH, pathname)).to_i.to_s | |
| File.join(dir, "#{basename}__#{time}#{ext}") | |
| end | |
| 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
| rewrite (.*)__([0-9]+)(\.js) $1$3 break; | |
| rewrite (.*)__([0-9]+)(\.css) $1$3 break; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment