You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This plugin is a good place to get started when building a cross-compatible Adobe Photoshop and Adobe XD plugin using vanilla Javascript. To make building for both platforms as simple as possible, this project makes use of Webpack. Because of this, you'll need to do some initial configuration before this will be usable in Adobe Photoshop or Adobe XD.
4
+
5
+
## Install dependencies
6
+
7
+
First ensure that your terminal is in the root of this project. Then:
8
+
9
+
For `yarn` users, install all dependencies using:
10
+
11
+
```
12
+
yarn install
13
+
```
14
+
15
+
For `npm` users, install all dependencies using:
16
+
17
+
```
18
+
npm install
19
+
```
20
+
21
+
## Build Process
22
+
23
+
### Development
24
+
25
+
To build the plugin for development, there are two scripts defined in the `package.json` file that can be used. Both scripts make use of the `host` key in the plugin's `manifest.json` file. Here, an array is used to specify the required versions for both Photoshop and XD. This allows the UXP Developer Tool to automatically create a plugin entry for each specified application when the plugin is loaded. Thus allowing you to test in both applications using the same manifest and `dist` folder.
26
+
27
+
Information on the two scripts can be found below:
28
+
29
+
-`yarn watch` or `npm run watch` will build a development version of the plugin, and recompile everytime you make a change to the source files. The result is placed in `dist`.
30
+
-`yarn build` or `npm run build` will build a development version of the plugin and place it in `dist`. It will not update every time you make a change to the source files.
31
+
32
+
### Production
33
+
34
+
To build the plugin for production, another set of scripts are defined in the `package.json` file. In production only one application can be specified in the `manifest.json` file unlike during development. To solve this, each script specifies a target application that will then be used by Webpack during the building process. Before the build is complete, the `host` key in the manifest file in the `dist` directory will be changed to match the desired target application.
35
+
36
+
Information on the two scripts can be found below:
37
+
38
+
-`yarn build-ps` or `npm run build-ps` will build a production version of the plugin for Adobe Photoshop and place it in `dist`.
39
+
-`yarn build-xd` or `npm run build-xd` will build a production version of the plugin for Adobe XD and place it in `dist`.
40
+
41
+
> You **must** run either `watch` or `build` prior to trying to use within Photoshop or XD!
42
+
43
+
## Launching in Photoshop and XD
44
+
45
+
You can use the UXP Developer Tools to load the plugin into Photoshop and XD.
46
+
47
+
If the plugin hasn't already been added to your workspace in the UXP Developer Tools, you can add it by clicking "Add Plugin..." and selecting `dist/manifest.json`. **DO NOT** select the `manifest.json` file inside the `plugin` folder.
48
+
49
+
Once added, two different entries will be created. One for use with Photoshop, and the other for use with XD. You can load it into Photoshop by clicking the ••• button on the corresponding row, and clicking "Load".
50
+
51
+
### Photoshop
52
+
53
+
To load the plugin into Photoshop, click the ••• button on the corresponding row, and click "Load". Switch to Photoshop and you should see the panel for the sample.
54
+
55
+
### XD
56
+
57
+
To load the plugin into XD, click the ••• button on the corresponding row, and click "Load". Switch to XD and then go to "Plugins" → Cross Compatible JS Sample → Cross Compatible JS Sample. This will then open the panel for the plugin.
58
+
59
+
## What this plugin does
60
+
61
+
This plugin doesn't do much, but does illustrate how to create a panel that interacts with both Photoshop and XD. The plugin primarily allows you to create a simple text label by providing text in the box under "Enter Text" and clicking on "Create Label". In addition, information on the current application can be viewed by clicking on the "?" button in the top right hand corner.
0 commit comments