Questions tagged [grunt-contrib-imagemin]

Minify PNG, JPEG and GIF images

Grunt task to optimize PNG, JPEG and GIF images.

46 questions
9
votes
4 answers

Grunt imagemin error: Cannot read property 'contents' of undefined

Grunt imagemin throws the following error when I try to run it: Running "imagemin:dynamic" (imagemin) task Fatal error: Cannot read property 'contents' of undefined Here's my package.json file: { "name": "project1", "version": "0.1.0", …
Justin Smith
  • 346
  • 1
  • 3
  • 17
6
votes
1 answer

How to exclude a directory from grunt-contrib-imagemin

I have the following snippet in my Gruntfile.js: imagemin: { options: { optimizationLevel: 7, cache: false }, dist: { files: [{ expand: true, cwd:…
Christopher
  • 592
  • 9
  • 31
6
votes
1 answer

Can not optimize images inside of the folder with grunt imagemin

I am trying to optimize images with grunt's imagemin module. My directory structure looks in the following way: publicImg main upload folder1 ... folderN Inside of each of the folders 1..N there are files. All of them are .jpg What I want to…
Salvador Dali
  • 214,103
  • 147
  • 703
  • 753
5
votes
3 answers

Yeaoman Grunt imagemin Fatal error: Cannot read property 'contents' of undefined

I keep on getting when running grunt build even with a clean Yeoman angular build: yo angular whatever. Warning: Running "imagemin:dist" (imagemin) task Fatal error: Cannot read property 'contents' of undefined
Mika
  • 5,807
  • 6
  • 38
  • 83
5
votes
5 answers

Error: spawn ENOENT for png files when using grunt-contrib-imagemin

I am trying to compress images with grunt-contrib-imagemin ~0.9.4 in a node.js application. My config is: imagemin: { dynamic: { files: [{ expand: true, cwd: 'server/static/img/', …
Jérôme Verstrynge
  • 57,710
  • 92
  • 283
  • 453
5
votes
0 answers

grunt imagemin error: Fatal error: write EPIPE

I'm getting the above error when I run the grunt dist, It worked perfectly fine with my other machine. Please find my gruntfile. $ grunt imagemin. Running "imagemin:png" (imagemin) task Minified 132 images (saved 134.02 kB) Running "imagemin:gif"…
5
votes
4 answers

imagemin:dist task throwing error

I've been attempting to solve this for over half the day now. I have an angularjs project that I use grunt to build. Running my grunt command give me the following: ``` Running "concurrent:dist" (concurrent) task Running "svgmin:dist" (svgmin)…
RavenHursT
  • 2,336
  • 1
  • 25
  • 46
5
votes
1 answer

Grunt Imagemin on New Files

I'm using Grunt Imagemin to optimize a folder of images. However everytime I run that command, it runs imagemin on ALL of the images. Is there a way to only run grunt imagemin when it detects new changes?
cusejuice
  • 10,285
  • 26
  • 90
  • 145
4
votes
2 answers

How to lossless optimize images with plugins for grunt-contrib-imagemin?

I am trying to lossless optimize JPEG / PNG images with imagemin, but I have a problem when using extensions, they "deoptimize", meaning the result image is bigger than the original. How can I prevent this? This is my…
max4ever
  • 11,909
  • 13
  • 77
  • 115
4
votes
1 answer

Minified all images - Grunt

I have more than 100 images in my images/ folder. Here is my imagemin - Grunt Config // The following *-min tasks produce minified files in the dist folder imagemin: { dist: { files: [{ expand: true, cwd: '<%= config.app…
code-8
  • 54,650
  • 106
  • 352
  • 604
4
votes
1 answer

grunt-contrig-imagemin Warning: Cannot call method 'replace' of undefined

I'm getting a weird warning when trying to use imagemin and nothing happens. grunt imagemin:primary Warning: Cannot call method 'replace' of undefined Used --force, continuing. Done, but with warnings. My task that gives me the error is as…
user391986
  • 29,536
  • 39
  • 126
  • 205
3
votes
0 answers

Grunt job (imagemin) failed due to Write EPIPE error

When i run a grunt job, the build is failed due to the below error + grunt imagemin --stack [4mRunning "imagemin:dist" (imagemin) task[24m [31mFatal error: write EPIPE[39m Error: write EPIPE at Object.exports._errnoException (util.js:856:11) …
sai
  • 300
  • 5
  • 19
3
votes
1 answer

grunt-contrib-imagemin - Take images of two different folders

I'm trying to set that grunt-imagemin take images of two different folders. I have two folders: Images-Users Images-Products. My idea is to use grunt-imagemin with grunt-watch then avoid doing this task manually. I have a website with lots of…
saeta
  • 4,048
  • 2
  • 31
  • 48
3
votes
3 answers

Grunt build fail due to imagemin issue, what is wrong?

I am trying to build an app using grunt build and I got this error: # grunt build Running "clean:dist" (clean) task Running "wiredep:app" (wiredep) task Running "wiredep:sass" (wiredep) task Running "includeSource:dist" (includeSource) task File…
ReynierPM
  • 17,594
  • 53
  • 193
  • 363
2
votes
2 answers

travis-ci build failure on grunt-contrib-imagemin task (Cannot ready property 'contents' of undefined

I am encountering an error during a travis-ci build for grunt-contrib-imagemin task... Warning: Running "imagemin:dist" (imagemin) task Fatal error: Cannot read property 'contents' of undefined The grunt build works successfully on my local…
1
2 3 4