Skip to content

Instantly share code, notes, and snippets.

@mrspeaker
Created July 29, 2013 08:55
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 mrspeaker/6103058 to your computer and use it in GitHub Desktop.
Save mrspeaker/6103058 to your computer and use it in GitHub Desktop.
Grunt file for Auto-exporting Pixelmator saving, with project reload
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', []);
};
@Silom
Copy link

Silom commented Mar 3, 2015

Can you tell me where I can find pxm command line tools ? (Can really find them myself)

@kfatehi
Copy link

kfatehi commented Mar 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment