Photoshop Assets Generator
Automate the extraction of photoshop assets using the GENERATOR PLUGIN, here you can find a detailed explanation on how you should name your layers in order for this library to work.
What this lib will do for you:
- Automatically launch photoshop
- Open a given array of files
- Activate the Generator Assets Plugin
- Close all documents after all assets has been generated, and optionally close photoshop.
Perfect for CI (Continuous Integration) This was the reason i built this anyway.
Why do i need this?
If you are developing something that grab some assets from a psd file, why not using the the magic of assets generation to streamline your pipeline? so then you don't have to export your assets every time you make some changes, and even better, if you are working with some kind of CI (Jenkins, Bamboo, Strider....) you can automate the assets extraction process!
Requirements
You must have photoshop installed in your local machine in order to this lib to work.
In photoshop's preferences go to plug-ins and make sure Enable Generator and Enable Remote Connections are checked.
Pick any Service Name you like, and input a Password (this lib defaults to 123456).
Install
npm install generator-exporter
Usage with Node
const files = glob; const generator = files password: '123456' generatorOptions: 'base-directory': path generatorstart;
Usage from Command Line
generator-cli --help generator-cli --files 'source/**/*.psd' --exclude '**/*(references|temp)/**' --password 654321 -c false -g.base-directory output
Config Options (OptionsInterface)
Property | Default | Description |
---|---|---|
closePhotoshop | true | Terminate photoshop after execution. |
hostname | 127.0.0.1 | The host the socket is listing to connections, defaults to your local IP. |
password | 123456 | The generator's password set inside photoshop plugins section. |
port | 49494 | Socket's port. |
maxRetries | 10 | Max number of retries this library will try to make with photoshop before assume it's dead. |
retryDelay | 5000 | Delay between each retry. |
generatorOptions | { ... } | See all the available options in here. |
Api
/** Create a Generator Instance **/const generator = string|string OptionsInterface /** Start Extraction **/generatorstart /** Self Explanatory **/generatorgeneratorgenerator