Last active
September 30, 2015 14:13
-
-
Save beerendlauwers/2473a836b8aa26045de0 to your computer and use it in GitHub Desktop.
Attempt at loading extra CSS in StackEdit without replacing default.css
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
// This doesn't seem to work. The browser only noticed the CSS file if it completely replaced <link type="text/css" rel="stylesheet" href="res-min/themes/default.css">. | |
// So, in a worst-case scenario, you can just copy that CSS file, add your changes to it, host it on Github and do the replacement with a UserCustom extension (https://github.com/benweet/stackedit/wiki/UserCustom-extensions). | |
// Also tried onReady https://github.com/benweet/stackedit/wiki/userCustom.onReady | |
$(document).ready( function() { | |
var loadCSS = function(href) { | |
var cssLink = $("<link rel='stylesheet' type='text/css' href='"+href+"'>"); | |
$("head").append(cssLink); | |
}; | |
var path = "url/to/css"; | |
loadCSS(path); | |
alert("loaded"); | |
} ); | |
// This code might also be useful if you want to target the current StackEdit theme <link>. | |
$("link").filter( function(elem) { | |
var isStylesheet = $(this).attr("rel") === "stylesheet"; | |
var isDefaultCss = $(this).attr("href").indexOf("res-min/themes/") === 0; | |
return isStylesheet && isDefaultCss; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment