Last active
December 13, 2015 17:58
-
-
Save danielres/4951525 to your computer and use it in GitHub Desktop.
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
// ==UserScript== | |
// @name capybara serving assets | |
// @namespace http://studio.pixarea.com | |
// @description adds base tag to serve assets in pages generated by capybara's "save_and_open_page" | |
// @include file:///*/tmp/capybara/capybara-*.html | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
// Note: you need to enable GreaseMonkey for local files for this to work: | |
// type "about:config" in the Firefox address bar, and set extensions.greasemonkey.fileIsGreaseable = true | |
for( i = 0; (l = document.getElementsByTagName("link")[i]); i++ ) { | |
if( l.getAttribute("rel").indexOf("style") >= 0 ) l.href = l.href.replace("file:///cucumber_test_assets/","http://localhost:3000/assets/"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment