Last active
December 28, 2015 09:09
-
-
Save tylorr/7476741 to your computer and use it in GitHub Desktop.
Asssetman config script example
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
/** | |
* All paths are relative to this file unless .fromBuild(true) is specified, | |
* then the paths are relative to where assetman was run aka the build dir. | |
*/ | |
rule('convert2').command('convert $in $out'); | |
rule('convert').command('convert $in -resize 50% $out'); | |
rule('atlas').command('binpack $in -o $name'); | |
/** | |
* Single - one input file, one output file | |
* $filename variable - replaced by filename of input file w/o extension | |
* Patterns are expanded into multiple build statements | |
* with one build clause per file matched. | |
*/ | |
var pattern = '**/*.psd'; | |
// .fromBuild(false) [default] input files come from source dir | |
// build foo@2x.png: convert2 ../src/foo.psd | |
single(pattern).to('$filename@2x.png').fromBuild(false).using('convert2'); | |
// .toExt(ext) shortcut for .to('$filename' + ext) | |
// build foo.png: convert ../src/foo.psd | |
single(pattern).toExt('.png').using('convert'); | |
/** | |
* Bundle - One or more inputs, one or more outputs | |
* no $filename variable (no .toExt(ext)) | |
* Patterns are expanded into a list of files for input | |
* into one build clause | |
*/ | |
var atlasName = 'atlas'; | |
// .fromBuild(true) input files come from build dir | |
// build atlas.png atlas.csv: atlas foo.png foo@2x.png | |
// name = atlas | |
bundle('*.png') | |
.to([atlasName + '.png', atlasName + '.csv']) | |
.fromBuild(true) | |
.assign('name', atlasName) | |
.using('atlas'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment