Created
April 11, 2013 09:15
-
-
Save tka/5361929 to your computer and use it in GitHub Desktop.
fire.app 相對路徑版 stylesheet_link_tag, javascript_include_tag
This file contains 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 ViewHelpers | |
def rel_stylesheet_link_tag(*f) | |
styles=stylesheet_link_tag *f | |
script_path = self.parser.script_filename.gsub(Compass.configuration.project_path, '') | |
child_folder= File.dirname( script_path.gsub(/\/[^\/]+/, '/..')[1..-1] ) | |
styles.gsub 'href="', "href=\"#{child_folder}" | |
end | |
def rel_javascript_include_tag(*f) | |
styles=javascript_include_tag *f | |
script_path = self.parser.script_filename.gsub(Compass.configuration.project_path, '') | |
child_folder= File.dirname( script_path.gsub(/\/[^\/]+/, '/..')[1..-1] ) | |
styles.gsub 'src="', "src=\"#{child_folder}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment