Skip to content

Commit

Permalink
Updated img min tool, minified images
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Totten committed Jan 14, 2016
1 parent 12c802e commit 8e71158
Show file tree
Hide file tree
Showing 34 changed files with 17 additions and 22 deletions.
Binary file modified media/articles/brute-force-protection/bfp-2015-12-29_1832.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/articles/connections/database/mysql/db-connection-widget.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/articles/connections/social/facebook/facebook-5a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/articles/connector/test-dc/powershell-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/articles/email-wall/case-studies/jet-priviledge/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/articles/hrd/R7mvAZpSnf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/connections/github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/connections/office-365.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/connections/open-id.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/connections/saml.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/connections/sharepoint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/landings/banner/twitter-card-iam.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/landings/iam-auth0/iam-auth0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/landings/iam-how-helps/iam-how-helps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/landings/iam-what-includes/iam-what-includes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/landings/iam-what-is/iam-what-is.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/landings/iam-why-need/iam-why-need.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/landings/rtokens-how-they-work/rtokens-how-they-work.png
Binary file modified media/landings/sl-how-it-works/sl-how-it-works.png
Binary file modified media/landings/sso-how-it-works/diagram-single-sign-on.png
Binary file modified media/platforms/golang.png
Binary file modified media/platforms/ios.png
Binary file modified media/platforms/saml.png
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
"devDependencies": {
"commander": "^2.8.1",
"dotenv": "^1.2.0",
"imagemin": "^4.0.0",
"imagemin-zopfli": "^4.1.0",
"lsr": "^1.0.0",
"tinify": "^1.1.1"
"tinify": "^1.1.1",
"zopflipng-bin": "^3.0.1"
}
}
34 changes: 13 additions & 21 deletions tools.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
require('dotenv').load();
var program = require('commander');
var fs = require('fs');
var lsr = require('lsr');
var tinify = require('tinify');
var path = require('path');

tinify.key = process.env.TINYPNG_KEY;
var mediaPath = path.join(__dirname, '/media');
var Imagemin = require('imagemin');
var imageminZopfli = require('imagemin-zopfli');

var redirectFilePath = './redirect-urls.json';
var addRedirect = function(oldUrl, newUrl, callback) {
Expand Down Expand Up @@ -48,24 +43,21 @@ program.command('mv <oldUrl> <newUrl>')
console.log('File renamed');
});
});
})
});


program.command('img')
.action(function() {
lsr
.sync(mediaPath)
.forEach(function(fileStat) {
var filepath = fileStat.path;
console.log('compressing ' + filepath);
// Skip non PNG files
if (!/\.png$/.test(filepath)) return;

var fullPath = path.join(mediaPath, filepath);
var source = tinify.fromFile(fullPath);
source.toFile(fullPath);
});

new Imagemin()
.src('media/**/*.png')
.dest('media')
.run((err, files) => {
if (err) {
console.error(err);
}
console.log('Minified ' + files.length + ' images.');
//=> {path: 'build/images/foo.jpg', contents: <Buffer 89 50 4e ...>}
});
});


Expand Down

0 comments on commit 8e71158

Please sign in to comment.