Skip to content

Instantly share code, notes, and snippets.

@tka
Created April 11, 2013 09:15
Show Gist options
  • Save tka/5361929 to your computer and use it in GitHub Desktop.
Save tka/5361929 to your computer and use it in GitHub Desktop.
fire.app 相對路徑版 stylesheet_link_tag, javascript_include_tag
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