Skip to content

Commit

Permalink
feat: added ability to change temporary directory (#65)
Browse files Browse the repository at this point in the history
This allows you to change the temporary directory that Sketch Constructor uses when copying images using an environment variable.
  • Loading branch information
L2jLiga authored and dbanksdesign committed Nov 5, 2019
1 parent c44cc76 commit a5eff43
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ Sketch.addPreview('/path/to/preview.png');
newSketch.build('newSketch.sketch');
```

### Temporary files

This library by defaults uses `.sketch-constructor` directory for placing temporary files like Bitmap images or preview.
We provide APIs to change default temporary directory by providing `STORAGE_DIR` environment variable.

### Read/manipulate an existing Sketch file
Getting data from or manipulating an existing Sketch file.

Expand Down
8 changes: 4 additions & 4 deletions utils/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
*/

/**
* Path to the temporary local image folder
* Path to the temporary sketch constructor folder
*/
const STORAGE_IMG_DIR = '.sketch-constructor/images';
const STORAGE_DIR = process.env.STORAGE_DIR || '.sketch-constructor';

/**
* Path to the temporary sketch constructor folder
* Path to the temporary local image folder
*/
const STORAGE_DIR = '.sketch-constructor';
const STORAGE_IMG_DIR = `${STORAGE_DIR}/images`;

/**
* Path to directory with preview file
Expand Down

0 comments on commit a5eff43

Please sign in to comment.