mirror of
https://github.com/sindresorhus/github-markdown-css.git
synced 2024-03-22 13:10:53 +08:00
bump deps and refactor code
This commit is contained in:
parent
209ee6dd9f
commit
688be4daf6
14
index.js
14
index.js
|
@ -43,11 +43,12 @@ function cleanupCss(str) {
|
||||||
var mdBodyProps = [];
|
var mdBodyProps = [];
|
||||||
|
|
||||||
style.stylesheet.rules = style.stylesheet.rules.filter(function (el) {
|
style.stylesheet.rules = style.stylesheet.rules.filter(function (el) {
|
||||||
if (el.type === 'keyframes' || el.type === 'comment') {
|
if (el.type === 'keyframes' || el.type === 'comment' || el.type === 'font-face') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (el.type === 'rule' && /::-webkit-validation|:-moz-placeholder|^\.integrations-slide-content|^\.prose-diff|@font-face|^\.octicon|^button::|^\.markdown-body .+(:hover|\.octicon)|^article$/.test(el.selectors[0])) {
|
if (el.type ==='rule') {
|
||||||
|
if (/::-webkit-validation|:-moz-placeholder|^\.integrations-slide-content|^\.prose-diff|@font-face|^\.octicon|^button::|^\.markdown-body .+(:hover|\.octicon)|^article$/.test(el.selectors[0])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,15 +74,16 @@ function cleanupCss(str) {
|
||||||
return selector;
|
return selector;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (el.declarations.length === 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// collect `.markdown-body` rules
|
// collect `.markdown-body` rules
|
||||||
if (el.selectors.length === 1 && el.selectors[0] === '.markdown-body') {
|
if (el.selectors.length === 1 && el.selectors[0] === '.markdown-body') {
|
||||||
[].push.apply(mdBodyProps, el.declarations);
|
[].push.apply(mdBodyProps, el.declarations);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (el.declarations.length === 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
10
package.json
10
package.json
|
@ -12,11 +12,13 @@
|
||||||
"email": "sindresorhus@gmail.com",
|
"email": "sindresorhus@gmail.com",
|
||||||
"url": "http://sindresorhus.com"
|
"url": "http://sindresorhus.com"
|
||||||
},
|
},
|
||||||
"contributors": [{
|
"contributors": [
|
||||||
|
{
|
||||||
"name": "Benjamin Tan",
|
"name": "Benjamin Tan",
|
||||||
"email": "demoneaux@gmail.com",
|
"email": "demoneaux@gmail.com",
|
||||||
"url": "http://d10.github.io/"
|
"url": "http://d10.github.io/"
|
||||||
}],
|
}
|
||||||
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
},
|
},
|
||||||
|
@ -40,8 +42,8 @@
|
||||||
"stylesheet"
|
"stylesheet"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cheerio": "^0.16.0",
|
"cheerio": "^0.17.0",
|
||||||
"css": "^1.6.0",
|
"css": "^2.0.0",
|
||||||
"got": "^0.3.0",
|
"got": "^0.3.0",
|
||||||
"temp-write": "^0.3.0",
|
"temp-write": "^0.3.0",
|
||||||
"uncss": "^0.8.1"
|
"uncss": "^0.8.1"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user