1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-31 07:44:22 +03:00

Bump dependencies and minor fix for inlineStyles

This commit is contained in:
GreLI
2017-10-22 22:29:15 +03:00
parent 2523799a12
commit d828a62100
4 changed files with 23 additions and 20 deletions

View File

@ -23,7 +23,7 @@ function flattenToSelectors(cssAst) {
var atrule = this.atrule;
var rule = node;
node.selector.children.each(function(selectorNode, selectorItem) {
node.prelude.children.each(function(selectorNode, selectorItem) {
var selector = {
item: selectorItem,
atrule: atrule,

View File

@ -48,28 +48,26 @@
"jshint": "jshint --show-non-errors ."
},
"dependencies": {
"coa": "~1.0.1",
"coa": "~2.0.0",
"colors": "~1.1.2",
"css-select": "^1.3.0-rc0",
"css-select-base-adapter": "^0.1.0",
"css-tree": "1.0.0-alpha22",
"csso": "^3.0.1",
"js-yaml": "~3.7.0",
"mkdirp": "~0.5.1",
"css-select": "~1.3.0-rc0",
"css-select-base-adapter": "~0.1.0",
"css-tree": "~1.0.0-alpha25",
"csso": "^3.3.1",
"js-yaml": "~3.10.0",
"object.values": "^1.0.4",
"sax": "~1.2.1",
"stable": "^0.1.5",
"whet.extend": "~0.9.9",
"sax": "~1.2.4",
"stable": "~0.1.6",
"util.promisify": "~1.0.0"
},
"devDependencies": {
"coveralls": "~2.11.14",
"fs-extra": "~4.0.1",
"coveralls": "~3.0.0",
"fs-extra": "~4.0.2",
"istanbul": "~0.4.5",
"mocha": "~3.2.0",
"mocha": "~4.0.1",
"mocha-istanbul": "~0.3.0",
"mock-stdin": "~0.3.1",
"should": "11.2.0"
"should": "~13.1.2"
},
"engines": {
"node": ">=4.0.0"

View File

@ -69,7 +69,7 @@ exports.fn = function(document, opts) {
parseCustomProperty: false
});
} catch (parseError) {
console.warn('Warning: Parse error of styles of <style/> element, skipped. Error details: ' + parseError);
// console.warn('Warning: Parse error of styles of <style/> element, skipped. Error details: ' + parseError);
continue;
}
@ -109,7 +109,7 @@ exports.fn = function(document, opts) {
selectedEls = document.querySelectorAll(selectorStr);
} catch (selectError) {
if (selectError.constructor === SyntaxError) {
console.warn('Warning: Syntax error when trying to select \n\n' + selectorStr + '\n\n, skipped. Error details: ' + selectError);
// console.warn('Warning: Syntax error when trying to select \n\n' + selectorStr + '\n\n, skipped. Error details: ' + selectError);
continue;
}
throw selectError;
@ -159,7 +159,7 @@ exports.fn = function(document, opts) {
if (opts.removeMatchedSelectors && selector.selectedEls !== null && selector.selectedEls.length > 0) {
// clean up matching simple selectors if option removeMatchedSelectors is enabled
selector.rule.selector.children.remove(selector.item);
selector.rule.prelude.children.remove(selector.item);
}
}
@ -205,7 +205,7 @@ exports.fn = function(document, opts) {
// clean up <style/> rulesets without any css selectors left
if (node.type === 'Rule' &&
node.selector.children.isEmpty()) {
node.prelude.children.isEmpty()) {
list.remove(item);
}
});

View File

@ -17,7 +17,12 @@
@@@
<svg id="test" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 81.285 81.285">
<rect width="100" height="100" style="fill:blue"/>
<defs>
<style>
@media only screen and (min-device-width:320px) and (max-device-width:480px) and (-webkit-min-device-pixel-ratio:2){.blue{fill: blue}}
</style>
</defs>
<rect width="100" height="100" class="blue"/>
</svg>
@@@

Before

Width:  |  Height:  |  Size: 699 B

After

Width:  |  Height:  |  Size: 897 B