andismith / grunt-responsive-images

Produce images at different sizes for responsive websites.
http://www.andismith.com/grunt-responsive-images/
MIT License
719 stars 96 forks source link

Svg support #128

Closed prteshJ closed 6 years ago

prteshJ commented 7 years ago

Expected Behaviour

All svg files should be compressed and resized.

Actual Behaviour

Grunt fails with >> Unable to compile; no valid source files were found.

Steps to Reproduce

Modify example to include svg instead of jpg,png or gif image formats. Run grunt.

PC/Mac and Graphics Engine used

Mac. ImageMagick.

Grunt Configuration

module.exports = function(grunt) {

grunt.initConfig({
    responsive_images: {
        dev: {
            options: {
                engine: 'im',
                sizes: [{
                    width: 800,
                    suffix: '_large_1x',
                    quality: 50
                }]
            },
            files: [{
                expand: true,
                src: ['*.{svg}'],
                cwd: 'images_src/',
                dest: 'images/'
            }]
        }
    },
});

grunt.loadNpmTasks('grunt-responsive-images');
grunt.registerTask('default', ['responsive_images']);

};

package.json { "name": "responsive-svg", "version": "0.1.0", "devDependencies": { "grunt": "^0.4.5", "grunt-contrib-jshint": "~0.10.0", "grunt-contrib-nodeunit": "~0.4.1", "grunt-contrib-uglify": "~0.5.0", "grunt-responsive-images": "^0.1.4" }, "dependencies": { "grunt-responsive-images": "^0.1.6" } }

andismith commented 6 years ago

Please use a tool such as https://github.com/sindresorhus/grunt-svgmin for SVG minification

prteshJ commented 6 years ago

Thank you. :)