Created
September 16, 2015 17:25
-
-
Save gregthebusker/97ff53a932fd7cf002ee to your computer and use it in GitHub Desktop.
Example of easy linting of sprites from sprity-js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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