Created
July 29, 2013 08:55
-
-
Save mrspeaker/6103058 to your computer and use it in GitHub Desktop.
Grunt file for Auto-exporting Pixelmator saving, with project reload
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
module.exports = function(grunt) { | |
// Project configuration. | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
watch: { | |
src: { | |
files : ['digibots/res/**/*.{png,jpg,jpeg,gif}', 'digibots/scripts/**/*.js', 'digibots/index.html'], | |
options : { | |
livereload: { | |
liveImg: false | |
}, | |
nospawn: true | |
} | |
}, | |
res: { | |
files : ['digibots/res/**/*.pxm'], | |
tasks : ['pxm2png'], | |
options : { | |
nospawn: true | |
}, | |
modified: [] | |
} | |
} | |
}); | |
grunt.registerTask('pxm2png', 'convert Pixelmator files to pngs', function() { | |
grunt.log.writeln('Converting pxm file: ' + grunt.config("res.modified")); | |
var cp = grunt.util.spawn({ | |
cmd: "./pxm2png", | |
args: grunt.config("res.modified") | |
}, function (err, res, code) { | |
if (code !== 0) { | |
grunt.log.writeln("Error converting .pxm file:", err, res, code); | |
} | |
}); | |
}); | |
// Set the pxm file changed to be retrieved by pxm2png task | |
grunt.event.on('watch', function(action, filepath) { | |
if (grunt.file.isMatch('digibots/res/*.pxm', filepath)) { | |
grunt.log.writeln('setting file path:' + filepath); | |
grunt.config("res", { modified: [filepath] }) | |
} | |
}); | |
// Load plugin | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
// Default task(s). | |
grunt.registerTask('default', []); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Silom here you go https://github.com/keyvanfatehi/grunt-pxm2png