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 atrule = this.atrule;
var rule = node; var rule = node;
node.selector.children.each(function(selectorNode, selectorItem) { node.prelude.children.each(function(selectorNode, selectorItem) {
var selector = { var selector = {
item: selectorItem, item: selectorItem,
atrule: atrule, atrule: atrule,

View File

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

View File

@ -69,7 +69,7 @@ exports.fn = function(document, opts) {
parseCustomProperty: false parseCustomProperty: false
}); });
} catch (parseError) { } 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; continue;
} }
@ -109,7 +109,7 @@ exports.fn = function(document, opts) {
selectedEls = document.querySelectorAll(selectorStr); selectedEls = document.querySelectorAll(selectorStr);
} catch (selectError) { } catch (selectError) {
if (selectError.constructor === SyntaxError) { 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; continue;
} }
throw selectError; throw selectError;
@ -159,7 +159,7 @@ exports.fn = function(document, opts) {
if (opts.removeMatchedSelectors && selector.selectedEls !== null && selector.selectedEls.length > 0) { if (opts.removeMatchedSelectors && selector.selectedEls !== null && selector.selectedEls.length > 0) {
// clean up matching simple selectors if option removeMatchedSelectors is enabled // 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 // clean up <style/> rulesets without any css selectors left
if (node.type === 'Rule' && if (node.type === 'Rule' &&
node.selector.children.isEmpty()) { node.prelude.children.isEmpty()) {
list.remove(item); 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"> <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> </svg>
@@@ @@@

Before

Width:  |  Height:  |  Size: 699 B

After

Width:  |  Height:  |  Size: 897 B