Skip to content

Instantly share code, notes, and snippets.

@elisehuard
Created March 19, 2010 12:01
Show Gist options
  • Save elisehuard/337452 to your computer and use it in GitHub Desktop.
Save elisehuard/337452 to your computer and use it in GitHub Desktop.
# helpers for local :javascripts and :stylesheets
# add
# yield :javascripts
# yield :stylesheets
# in your header
def load_javascripts(*scripts)
load_content(:javascripts,*scripts) do |script|
javascript_include_tag script
end
end
def load_stylesheets(*args)
load_content(:stylesheets,*args) do |css|
stylesheet_link_tag css
end
end
def load_content(name,*args)
content_for name do
args.map do |arg|
yield(arg)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment