1.1.3 • Published 7 years ago

generator-exporter v1.1.3

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

Photoshop Assets Generator

npm version npm downloads dependencies

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

import { Generator } from 'generator-exporter'
import * as glob from 'glob'
import * as path from 'path'

const files = glob.sync(
    path.resolve(__dirname, '**/*.psd')
);

const generator = new Generator(files, {
    password: '123456',
    generatorOptions: {
        'base-directory': path.resolve(__dirname, 'output')
    }
})

generator.start().then(files => console.log(files));

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)

PropertyDefaultDescription
closePhotoshoptrueTerminate photoshop after execution.
hostname127.0.0.1The host the socket is listing to connections, defaults to your local IP.
password123456The generator's password set inside photoshop plugins section.
port49494Socket's port.
maxRetries10Max number of retries this library will try to make with photoshop before assume it's dead.
retryDelay5000Delay between each retry.
generatorOptions{ ... }See all the available options in here.

Api

/** Create a Generator Instance  **/
const generator = new Generator(string|string[], OptionsInterface)

/** Start Extraction **/
generator.start().then(files => {})

/** Self Explanatory **/
generator.closePhotoshop()
generator.closeActiveDocument()
generator.closeAllDocuments()

License

MIT

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.19

7 years ago

1.0.18

7 years ago

1.0.17

7 years ago

1.0.16

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago