marrone / grunt-tinypng Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Hello.
I'm back again with my 265 images to optimize. π
And I noticed that I need to run many times grunt-tinypng to optimize all this images.
First wave
Running "tinypng:compress" (tinypng) task
β Upload: [||||||||||||||||||||] 100% (93/93 images)
β Download: [||||||||||||||||||||] 100% (93/93 images)
Skipped: 172 images, Compressed: 93 images, Savings: 21.37 KB (ratio: 0.8272)
Second wave
Running "tinypng:compress" (tinypng) task
β Upload: [||||||||||||||||||||] 100% (21/21 images)
β Download: [||||||||||||||||||||] 100% (21/21 images)
Skipped: 244 images, Compressed: 21 images, Savings: 1.35 KB (ratio: 0.9321)
Third wave
Running "tinypng:compress" (tinypng) task
β Upload: [||||||||||||||||||||] 100% (3/3 images)
β Download: [||||||||||||||||||||] 100% (3/3 images)
Skipped: 262 images, Compressed: 3 images, Savings: 64 bytes (ratio: 0.9785)
So, I think some files are not downloaded from tinypng correctly, or not saved... I don't know.
I can give you more informations about this if you want.
Does this task process .jpg images too?
If yes, how would the compress task options look for compressing both .jpg and .png?
If not, could that be added (since the tinypng API can process .jpg)?
I can't imagine my life without your great plugin, but I have an issue I face every month when I reach my API limit :
On error, summary about optimized files doesn't appear. Is it possible to show the summary even on error ?
Thanks a lot !
Hi
I am getting an error only with the pngs.
The message error is:
Running "tinypng:compress_png" (tinypng) task
Warning: Cannot read property 'setRawMode' of null Use --force to continue.
Thanks
Hello,
First of all, thanks a lot for your wonderful tool that allows us to use a compressor far more efficient than imagemin
(for png, at least).
I have an issue while downloading files, probably due to a bad error handling (I'm investigating).
But sigFile
seems to be only generated after all files have been downloaded... And if an issue stop you before... You'll have to submit all files again, and use a lot of API calls for nothing.
It will be great if this file was updated after each download.
Thanks !
Hi,
I implemented a task into a yeoman project according to your example:
tinypng: {
options: {
apiKey: '...',
checkSigs: true,
sigFile: '<%= config.app %>/images/file_sigs.json',
summarize: true,
showProgress: true,
stopOnImageError: true
},
compress: {
files: [{
expand: true,
cwd: '<%= config.app %>/images',
src: '{,*/}*.{gif,jpeg,jpg,png}',
dest: '<%= config.dist %>/images'
}]
}
},
Images are compressed and the sigFile is written to the provided location but it seems to be ignored on subsequent runs. All images are compressed again. Am I missing something?
Thanks in advance.
Cheers
BjΓΆrn
Hello,
I'm trying to compress a huge quantity if images, and tinypng seems to fails compress it.
Here's the output :
Running "tinypng:compress" (tinypng) task
β Upload: [||||||||||||||||||||] 100% (220/220 images)
β Download:
>> problem with request: read ECONNRESET
>> problem with request: read ECONNRESET
>> problem with request: read ECONNRESET
(lot more lines liks these)
>> got error, read ECONNRESET, making request for minified image at https://api.tinypng.com/output/f
1n2dgr45oc1n41t.png
>> got error, read ECONNRESET, making request for minified image at https://api.tinypng.com/output/k
isstpfu7g21oncq.png
>> got error, read ECONNRESET, making request for minified image at https://api.tinypng.com/output/v
7cvhch14m68s6cl.png
>> got error, read ECONNRESET, making request for minified image at https://api.tinypng.com/output/f
g5fbpt1kl8q1iod.png
And then... I can't access to https://tinypng.com/ (from my computer, but my colleagues can) and grunt-tinypng says
>> problem with request: connect ETIMEDOUT
Maybe you should send request 20 by 20, to avoid this situation...
For some reason last version was not published on NPM and we are only able to use v0.6.1.
Please publish v0.7.0
Is there any way to make the signatures json file to be written in an uncompressed format? Currently it adds everything in one line (compressed) which makes conflicts difficult to solve.
Thanks in advance!
At first thanks for the great plugin.
I have small issue:
grunt-tinypng stops other grunt tasks when no files should be minified
I am using such options grunt-tinypng:
tinypng:
options:
apiKey: 'qwerty'
checkSigs: true
sigFile: 'tinypng-signatures.json'
dist:
expand: true
cwd: '<%= yeoman.app %>/images/lossy/original/'
src: '{,*/}*.png'
dest: '<%= yeoman.app %>/images/lossy/'
and when i run such build task:
grunt.registerTask "build", [
"clean:dist"
"concurrent:dist"
"uglify:dist"
"autoprefixer:dist"
"tinypng:dist"
"copy"
"imagemin"
"svgmin"
"cssmin"
"notify:dist"
]
i recieve such output in console:
...
comparing hash of image at src/images/lossy/original/contacts-map.png
file sig matches, skipping minification of file at src/images/lossy/original/map.png
and no task running after tinypng:dist
I have to tasks running when watching *.png files, one is grunt-tinypng and grunt-imgo. First I use grunt-tinypng and after it finished grunt-imgo, but sometimes I get an error
Running "tinypng:compress" (tinypng) task
β Upload: [ ] 0% (1/1 image)
β Download:
>> got error response from api: {"error":"InputMissing","message":"File is empty"}
and no other task will run afterwards, how can I properly handle this situation?
Thank you!
Hello.
Some images seems to be bigger with tinypng.
It should compare size and keep the smallest one...
Hi there,
Once again, thanks for your great plugin! :-)
I'm getting an issue with the saving value when the processed file is not smaller :
Running "tinypng:compress" (tinypng) task
β Upload: [||||||||||||||||||||] 100% (1/1 image)
β Download:
Skipped: 31 images, Compressed: 1 image, Savings: 87.46 KB (ratio: 0)
There is no file downloaded, but Savings: 87.46 KB (ratio: 0)
.
The filesize here is 87.46 exactly.
Any ideas?
Thanks!
I have a proxy on my server and grunt-tinypng does not work with a proxy.
I had to edit the plugin by adding an agent (with https-proxy-agent) and also modify the code for the method downloadOutputImage:
var opt = {
host: urlInfo.hostname,
path: urlInfo.pathname,
method: 'GET',
accepts: '/',
rejectUnauthorized: false,
requestCert: true,
agent: agent
};
https.get(opt, function(imageRes) {...
You can change your code to handle a proxy?
Thank you
'path' in the rename example causes an error; it's undefined
I am getting this error all other task are working fine accept tinypng I am using windows 8.1 npm 0.12 and grunt 0.4+
Loading "tinypng.js" tasks...ERROR
Error: Cannot find module 'graceful-fs'
Warning: Task "tinypng" not found. Use --force to continue.
Aborted due to warnings.
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.