Skip to content

Commit

Permalink
Fixed error on empty or CDATA styles. Fixed svg#455. Fixes svg#456
Browse files Browse the repository at this point in the history
  • Loading branch information
GreLI committed Nov 21, 2015
1 parent da5107a commit fc174aa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/minifyStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ var minifyCss = function(css, options) {
exports.fn = function(item, svgoOptions) {

if(item.elem) {
if(item.isElem('style')) {
var styleCss = item.content[0].text;
if(item.isElem('style') && !item.isEmpty()) {
var styleCss = item.content[0].text || item.content[0].cdata || [];
if(styleCss.length > 0) {
var styleCssMinified = minifyCss(styleCss, svgoOptions);
item.content[0].text = styleCssMinified;
Expand Down
19 changes: 19 additions & 0 deletions test/plugins/minifyStyles.02.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fc174aa

Please sign in to comment.