somerandomdude / grunt-webp Goto Github PK
View Code? Open in Web Editor NEWConvert your images to WebP format.
License: MIT License
Convert your images to WebP format.
License: MIT License
Here's the snippet from my Grunt.js
dist:{
files: [{
expand: true,
cwd: 'src/img',
src:['*.jpg'],
dest:'src/img/',
ext:'.jpg.webp'
}],
},
options:{
quality:85,
},
},
When ever I run grunt webp, folders with name as [filename].jpg.webp
get created and the actual .webp files reside inside them.
I don't want this to happen. I want my actual webp files to have the name [filename].jpg.webp
and no extra folders should be created (as the dest
is already mentioned).
Is there a way to traverse and entire directory & subdirectories creating WebP images whilst retaining their location as the same as the src location?
I had a go at using this, but couldn't get it to work... and example config would be really helpful.
Please make a minor release so that the binpath
option becomes available via npm install
.
I noticed you have grunt-lib-contrib as a dependency.
It's deprecated and I would recommend you switch to the extracted modules instead:
stripPath
=> strip-path
minMaxInfo
=> maxmin
getNamespaceDeclaration
=> ticket
My Linux distribution comes with outdated version of WebP, thus I would like to use the one I download by hand.
Thus requesting an option for defining the path for the cwebp binary, which would default to 'cwebp'
Hi,
I think I've followed the README but I've run into some issues - this is what I've done. I've taken this project and run npm install grunt-webp --save
then npm install webp-bin --save
, my Gruntfile.js looks like this.
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
webp: {
files: {
src: 'images/photoshop/*.png',
dest: 'images/webp'
},
options: {
binpath: require('webp-bin').path,
preset: 'default',
verbose: true
}
}
});
grunt.loadNpmTasks('grunt-webp');
};
I think this looks ok, but when I run grunt webp
I get the following output;
Running "webp:files" (webp) task
/Users/masonj/Development/image-optimisation-tools-comparison/node_modules/webp-bin/vendor/osx/cwebp -preset default -v images/photoshop/png24-interlaced_bril.png,images/photoshop/png24-interlaced_grote-ogen.png,images/photoshop/png24-interlaced_logo.png,images/photoshop/png24-interlaced_oog.png,images/photoshop/png24-interlaced_patroon.png,images/photoshop/png24-interlaced_rood.png,images/photoshop/png24-interlaced_skyline.png,images/photoshop/png24-interlaced_streepjes.png,images/photoshop/png24-interlaced_wolk.png,images/photoshop/png24_bril.png,images/photoshop/png24_grote-ogen.png,images/photoshop/png24_logo.png,images/photoshop/png24_oog.png,images/photoshop/png24_patroon.png,images/photoshop/png24_rood.png,images/photoshop/png24_skyline.png,images/photoshop/png24_streepjes.png,images/photoshop/png24_wolk.png,images/photoshop/png8-interlaced_bril.png,images/photoshop/png8-interlaced_grote-ogen.png,images/photoshop/png8-interlaced_logo.png,images/photoshop/png8-interlaced_oog.png,images/photoshop/png8-interlaced_patroon.png,images/photoshop/png8-interlaced_rood.png,images/photoshop/png8-interlaced_skyline.png,images/photoshop/png8-interlaced_streepjes.png,images/photoshop/png8-interlaced_wolk.png,images/photoshop/png8_bril.png,images/photoshop/png8_grote-ogen.png,images/photoshop/png8_logo.png,images/photoshop/png8_oog.png,images/photoshop/png8_patroon.png,images/photoshop/png8_rood.png,images/photoshop/png8_skyline.png,images/photoshop/png8_streepjes.png,images/photoshop/png8_wolk.png -o .webpimages/webp
Error! Cannot open input file 'images/photoshop/png24-interlaced_bril.png,images/photoshop/png24-interlaced_grote-ogen.png,images/photoshop/png24-interlaced_logo.png,images/photoshop/png24-interlaced_oog.png,images/photoshop/png24-interlaced_patroon.png,images/photoshop/png24-interlaced_rood.png,images/photoshop/png24-interlaced_skyline.png,images/photoshop/png24-interlaced_streepjes.png,images/photoshop/png24-interlaced_wolk.png,images/photoshop/png24_bril.png,images/photoshop/png24_grote-ogen.png,images/photoshop/png24_logo.png,images/photoshop/png24_oog.png,images/photoshop/png24_patroon.png,images/photoshop/png24_rood.png,images/photoshop/png24_skyline.png,images/photoshop/png24_streepjes.png,images/photoshop/png24_wolk.png,images/photoshop/png8-interlaced_bril.png,images/photoshop/png8-interlaced_grote-ogen.png,images/photoshop/png8-interlaced_logo.png,images/photoshop/png8-interlaced_oog.png,images/photoshop/png8-interlaced_patroon.png,images/photoshop/png8-interlaced_rood.png,images/photoshop/png8-interlaced_skyline.png,images/photoshop/png8-interlaced_streepjes.png,images/photoshop/png8-interlaced_wolk.png,images/photoshop/png8_bril.png,images/photoshop/png8_grote-ogen.png,images/photoshop/png8_logo.png,images/photoshop/png8_oog.png,images/photoshop/png8_patroon.png,images/photoshop/png8_rood.png,images/photoshop/png8_skyline.png,images/photoshop/png8_streepjes.png,images/photoshop/png8_wolk.png'
Error! Cannot read input picture file 'images/photoshop/png24-interlaced_bril.png,images/photoshop/png24-interlaced_grote-ogen.png,images/photoshop/png24-interlaced_logo.png,images/photoshop/png24-interlaced_oog.png,images/photoshop/png24-interlaced_patroon.png,images/photoshop/png24-interlaced_rood.png,images/photoshop/png24-interlaced_skyline.png,images/photoshop/png24-interlaced_streepjes.png,images/photoshop/png24-interlaced_wolk.png,images/photoshop/png24_bril.png,images/photoshop/png24_grote-ogen.png,images/photoshop/png24_logo.png,images/photoshop/png24_oog.png,images/photoshop/png24_patroon.png,images/photoshop/png24_rood.png,images/photoshop/png24_skyline.png,images/photoshop/png24_streepjes.png,images/photoshop/png24_wolk.png,images/photoshop/png8-interlaced_bril.png,images/photoshop/png8-interlaced_grote-ogen.png,images/photoshop/png8-interlaced_logo.png,images/photoshop/png8-interlaced_oog.png,images/photoshop/png8-interlaced_patroon.png,images/photoshop/png8-interlaced_rood.png,images/photoshop/png8-interlaced_skyline.png,images/photoshop/png8-interlaced_streepjes.png,images/photoshop/png8-interlaced_wolk.png,images/photoshop/png8_bril.png,images/photoshop/png8_grote-ogen.png,images/photoshop/png8_logo.png,images/photoshop/png8_oog.png,images/photoshop/png8_patroon.png,images/photoshop/png8_rood.png,images/photoshop/png8_skyline.png,images/photoshop/png8_streepjes.png,images/photoshop/png8_wolk.png'
255Error! Cannot open input file 'images/photoshop/png24-interlaced_bril.png,images/photoshop/png24-interlaced_grote-ogen.png,images/photoshop/png24-interlaced_logo.png,images/photoshop/png24-interlaced_oog.png,images/photoshop/png24-interlaced_patroon.png,images/photoshop/png24-interlaced_rood.png,images/photoshop/png24-interlaced_skyline.png,images/photoshop/png24-interlaced_streepjes.png,images/photoshop/png24-interlaced_wolk.png,images/photoshop/png24_bril.png,images/photoshop/png24_grote-ogen.png,images/photoshop/png24_logo.png,images/photoshop/png24_oog.png,images/photoshop/png24_patroon.png,images/photoshop/png24_rood.png,images/photoshop/png24_skyline.png,images/photoshop/png24_streepjes.png,images/photoshop/png24_wolk.png,images/photoshop/png8-interlaced_bril.png,images/photoshop/png8-interlaced_grote-ogen.png,images/photoshop/png8-interlaced_logo.png,images/photoshop/png8-interlaced_oog.png,images/photoshop/png8-interlaced_patroon.png,images/photoshop/png8-interlaced_rood.png,images/photoshop/png8-interlaced_skyline.png,images/photoshop/png8-interlaced_streepjes.png,images/photoshop/png8-interlaced_wolk.png,images/photoshop/png8_bril.png,images/photoshop/png8_grote-ogen.png,images/photoshop/png8_logo.png,images/photoshop/png8_oog.png,images/photoshop/png8_patroon.png,images/photoshop/png8_rood.png,images/photoshop/png8_skyline.png,images/photoshop/png8_streepjes.png,images/photoshop/png8_wolk.png'
Error! Cannot read input picture file 'images/photoshop/png24-interlaced_bril.png,images/photoshop/png24-interlaced_grote-ogen.png,images/photoshop/png24-interlaced_logo.png,images/photoshop/png24-interlaced_oog.png,images/photoshop/png24-interlaced_patroon.png,images/photoshop/png24-interlaced_rood.png,images/photoshop/png24-interlaced_skyline.png,images/photoshop/png24-interlaced_streepjes.png,images/photoshop/png24-interlaced_wolk.png,images/photoshop/png24_bril.png,images/photoshop/png24_grote-ogen.png,images/photoshop/png24_logo.png,images/photoshop/png24_oog.png,images/photoshop/png24_patroon.png,images/photoshop/png24_rood.png,images/photoshop/png24_skyline.png,images/photoshop/png24_streepjes.png,images/photoshop/png24_wolk.png,images/photoshop/png8-interlaced_bril.png,images/photoshop/png8-interlaced_grote-ogen.png,images/photoshop/png8-interlaced_logo.png,images/photoshop/png8-interlaced_oog.png,images/photoshop/png8-interlaced_patroon.png,images/photoshop/png8-interlaced_rood.png,images/photoshop/png8-interlaced_skyline.png,images/photoshop/png8-interlaced_streepjes.png,images/photoshop/png8-interlaced_wolk.png,images/photoshop/png8_bril.png,images/photoshop/png8_grote-ogen.png,images/photoshop/png8_logo.png,images/photoshop/png8_oog.png,images/photoshop/png8_patroon.png,images/photoshop/png8_rood.png,images/photoshop/png8_skyline.png,images/photoshop/png8_streepjes.png,images/photoshop/png8_wolk.png'
Warning: 255 Use --force to continue.
Aborted due to warnings.
Any help would be appreciated, thanks a lot @somerandomdude.
I tried using the example gruntfile and it doesn't work, even if the output/path folders exist.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.