Skip to content

Instantly share code, notes, and snippets.

@gregthebusker
Created September 16, 2015 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregthebusker/97ff53a932fd7cf002ee to your computer and use it in GitHub Desktop.
Save gregthebusker/97ff53a932fd7cf002ee to your computer and use it in GitHub Desktop.
Example of easy linting of sprites from sprity-js
var gutil = require('gulp-util');
module.exports = () => {
var Sprite = require('./Sprite.js');
for (var folderName in Sprite) {
var folder = Sprite[folderName];
for (var imageName in folder) {
var image = folder[imageName];
var hoverImage = folder[imageName + 'Hover'];
var activeImage = folder[imageName + 'Active'];
if (hoverImage) {
if (hoverImage.width != image.width ||
hoverImage.height != image.height) {
gutil.log(gutil.colors.yellow("[Sprite]"), gutil.colors.red.underline(imageName));
gutil.log('Dimensions: ' + image.width + ' x ' + image.height);
gutil.log(gutil.colors.green('Hover Dimensions:'), hoverImage.width + ' x ' + hoverImage.height);
}
}
if (activeImage) {
if (activeImage.width != image.width ||
activeImage.height != image.height) {
gutil.log(gutil.colors.yellow("[Sprite]"), gutil.colors.red.underline(imageName));
gutil.log('Dimensions: ' + image.width + ' x ' + image.height);
gutil.log(gutil.colors.cyan('Active Dimensions:'), activeImage.width + ' x ' + activeImage.height);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment