Free texture packer also released as grunt module
Installation:
$ npm install grunt-free-tex-packer
Basic usage (Gruntfile.js):
module.exports = function(grunt) { grunt.initConfig({ free_tex_packer: { demo: { files: [ {expand: true, src: 'src/**/*', basePath: 'src/', filter: 'isFile'} ], options: { dest: 'dest' } } } }); grunt.loadNpmTasks('grunt-free-tex-packer'); grunt.registerTask('default', ['free_tex_packer']); };
Advanced usage (Gruntfile.js):
module.exports = function(grunt) { grunt.initConfig({ free_tex_packer: { demo: { files: [ {expand: true, src: 'src/**/*', basePath: 'src/', filter: 'isFile'} ], options: { dest: 'dest', textureName: "my-texture", width: 1024, height: 1024, fixedSize: false, padding: 2, allowRotation: true, detectIdentical: true, allowTrim: true, exporter: "Pixi", removeFileExtension: true, prependFolderName: true } } } }); grunt.loadNpmTasks('grunt-free-tex-packer'); grunt.registerTask('default', ['free_tex_packer']); };
Additional parameters:
basePath in files – path to be removed from sprite name in texture
dest in options – destination folder path
Demo
- Install node.js
- Dowload demo
- Unpack
- Execute in console:
npm install -g grunt
npm install
grunt
- Look at dest folder!