svg / svgo

⚙️ Node.js tool for optimizing SVG files
https://svgo.dev/
MIT License
20.81k stars 1.38k forks source link

Warning: Error parsing SVG: No whitespace between attributes #342

Closed rowild closed 9 years ago

rowild commented 9 years ago

I keep getting this warning, even though the SVG does not have any multiple attriibutes. Any idea what's wrong?

<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="1024px" height="768px" viewBox="0 0 1024 768">
    <title>SEA-Background</title>
    <desc>Some description here</desc>
    <style type="text/css">
        .st0 { fill: #57B2F7; stroke: #000000; stroke-miterlimit: 10; }
        .st1 { fill: #37CCDB; }
    </style>
    <g id="bg">
        <rect x="0.5" y="-0.5" class="st0" width="1024" height="768"/>
    </g>
    <g id="waves">
        <path class="st1" d="M1024,168l-0.13,50c-66.41-5-77.98,0-119.44,11.12C862.98,240.25,849.32,242,746.4,251s-119.59-7-237.06-21 c-117.48-14-84.27-20-183.03-24s-70.03,1-152.16,12S85,218-1,218v-50c84,0,95.5-11,127.5-24s56.38-33,122.38-31 s80.06,16.86,158.06,27.43S565.97,167,612.97,156s56.06-20.06,115.02-23c20-1,102.04-2.26,137.01,7.43 C914.41,154.12,945.17,168,1024,168z"/>
        <path class="st1" d="M1023,339.63V506h-56c-30.87,0-22.13-0.42-95-9.76c-72.88-9.34-47-7.96-117-19.84 c-70-11.88-70.01-12.79-130.01-3.45c-60,9.34-87.01,24.6-158.01,23.75c-71-0.85-99.01-12.74-127.01-20.38 c-28-7.64-60.03-10.18-92.03-9.34s-73.06,9.36-96.06,12.75c-23,3.4-62.38,17.87-74.38,20.42c-12,2.55-57.5,5.2-78.5,5.2V340 c0,0,28.12,0,53,0s128,6.39,155,14.03c27,7.64,67,28.87,107,39.06s85,10.19,96,6.8c11-3.4,34-15.28,46-22.91 c12-7.64,14-21.22,43-36.92c29-15.7,70-17.4,78-17.4s73.12-6.79,112,5.09s37,25.57,91,33.58c54,8.01,99.5,7.27,142.5,0 C965.5,354.06,976,339.63,1023,339.63z"/>
        <path class="st1" d="M1022,612v64h-20c-2.88,0-21-7.5-30-9.5s-18-4.38-37-7.32c-19-2.95-35,10.88-57,15.88s-28,7.97-47,10.66 c-19,2.7-41.12-10.71-49-10.71s-63,13.99-85,21.99s-20,11-41,14s-51,0-62,0s-56-14-92-20.56c-36-6.55-32-1.44-49-0.44s-36,0-54,0 s-56-3-72-6s-43.12-9-76-16.72c-32.88-7.72-39-3.28-55-7.28s-63,6.25-71,6.25S83.87,676,54,676s-27,0-55,0v-64c0,0,29.13,0,35,0 s38,8.5,59,17.5s53,11.74,72,11.74s58-1.87,89-6.87s71-8.34,112-2.34s72,20.98,120,21.98s98-7.01,127-13.01s57-16,83-18s58-10,91-1 s67,16.59,99,10.79c32-5.79,36.12-9.29,61-15.29s44.13-5.5,56-5.5S1012,612,1022,612z"/>
    </g>
</svg>

On calling grunt svgmin, it stops working after the first path...

   svgmin: {
            //options: {
            //    plugins: [
            //        {cleanupAttrs:false},
            //        {cleanupEnableBackground:false},
            //        {cleanupIDs:false},
            //        //{removeTitle: false},
            //        //{removeDesc: false},
            //        //{removeMetadata: false},
            //        //{removeViewBox: false},               // don't remove the viewbox atribute from the SVG
            //        //{removeUselessStrokeAndFill: false},  // don't remove Useless Strokes and Fills
            //        //{removeEmptyAttrs: false}             // don't remove Empty Attributes from the SVG
            //        {removeUnknownsAndDefaults:false},
            //        {removeUnusedNS:false},
            //        {removeXMLProcInst:false}
            //    ]
            //},
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= config.app %>/svg',
                    src: '{,*/}*.svg',
                    dest: '<%= config.dist %>/svg'
                }]
            }
        },
rowild commented 9 years ago

Stupid me - the error was in the next file, not the one I posted. Sorry for this useless post!

Any chance to tell grunt to spit out the file name along with the error?

GreLI commented 9 years ago

Sorry, can't say nothing about grunt.