File tree Expand file tree Collapse file tree
image-middleware-pngquant Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ exports . install = function ( ) {
2+ F . route ( '/' ) ;
3+ F . resize ( '/img/*.png' , '50%' ) ;
4+ } ;
Original file line number Diff line number Diff line change 1+ var PngQuant = require ( 'pngquant' ) ;
2+
3+ Image . middleware ( 'png' , function ( ) {
4+ return new PngQuant ( [ 128 ] ) ;
5+ } ) ;
Original file line number Diff line number Diff line change 1+ require ( 'total.js' ) . http ( 'debug' ) ;
Original file line number Diff line number Diff line change 1+ - total.js +v1.9.7
2+ - you must have installed GraphicsMagick or ImageMagick
3+ - install ` npm install -g pngquant `
Original file line number Diff line number Diff line change 1+ @{layout('')}
2+ <!DOCTYPE html>
3+ < html >
4+ < head >
5+ < meta charset ="utf-8 " />
6+ < meta http-equiv ="X-UA-Compatible " content ="IE=11 " />
7+ < meta name ="format-detection " content ="telephone=no " />
8+ < meta name ="viewport " content ="width=device-width, initial-scale=1 " />
9+ < meta name ="robots " content ="all,follow " />
10+ </ head >
11+ < body style ="font: normal normal 12px Arial ">
12+ < div > The image is resized about 50% and shrinked with PNGQUANT. Try to remove the middleware with PNGQUANT and watch the file size.</ div >
13+ < br />
14+ < div > < img src ="/img/logo.png " alt ="Logo " /> </ div >
15+ </ body >
16+ </ html >
You can’t perform that action at this time.
0 commit comments