Skip to content

Instantly share code, notes, and snippets.

@monnoval
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save monnoval/1c5df8fe3113c7b944db to your computer and use it in GitHub Desktop.

Select an option

Save monnoval/1c5df8fe3113c7b944db to your computer and use it in GitHub Desktop.
Middleman - Append partial in page via javascript
/ If there are parts in the page that can only be manipulated by js
- anchor_links_html = partial "layouts/links"
- anchor_links = anchor_links_html.gsub(/(\n|\t|\r)/, " ").gsub(/>\s*</, "><")
:javascript
$(document).ready(function(){
$("#selector").append("#{anchor_links}");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment