Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@Silom Silom commented Mar 3, 2015

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

@kfatehi

This comment has been minimized.

Copy link

@kfatehi kfatehi commented Mar 15, 2015

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