Skip to content

Instantly share code, notes, and snippets.

@CasperLaiTW
Forked from tka/view_helpers.rb
Created April 6, 2014 15:42
Show Gist options
  • Save CasperLaiTW/10007789 to your computer and use it in GitHub Desktop.
Save CasperLaiTW/10007789 to your computer and use it in GitHub Desktop.
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