oscarmorrison / md-page

📝 create a webpage with just markdown
https://oscarmorrison.github.io/md-page/
MIT License
1.29k stars 99 forks source link

Make stylesheet first child of document.head #37

Closed p1ho closed 5 years ago

p1ho commented 5 years ago

Original Issue #19 By making the stylesheet the first child, users can now apply styles that conflicts with the default stylesheet.

Example:

<style>
    body {
        padding: 0;
    }
</style>
<script src="http://livejs.com/live.js"></script>
<script src="showdown.js"></script>
<script src="script.js"></script><noscript>

# header one

the padding of body will be 0 instead of default value.

This also works

<link href="custom.css" rel="stylesheet"></link>
<script src="http://livejs.com/live.js"></script>
<script src="showdown.js"></script>
<script src="script.js"></script><noscript>

# header one

If there are conflicting styles in custom.css with the default stylesheet, custom.css will take precedence.

oscarmorrison commented 5 years ago

thanks @p1ho.

Do you run the uglify/minify on pr?

p1ho commented 5 years ago

No problem, yes I did. For convenience, I'll just post a snapshot to the relevant code changes in the uglified file.

If you do a search of document.head on the raw file

image