Skip to main content
Inspiring
July 19, 2020
Question

Splitting up cep extension to multiple jsx

  • July 19, 2020
  • 2 replies
  • 331 views

So I'm currently working on adding support for both Photoshop and Illustrator and in doing so my codebase started to get a bit messy. So I started refactoring it down to multiple files to make it cleaner and maintainable. 

 

So I've learned that I need to use $.evalFile('path/to/.jsx/'). 

So far so good. And this seems to work as exptected in Photoshop.

However I can't seem to access app.activeDocument in Illustrator in the separate .jsx file. 

 

Does anyone have any good advice for setting up a good stucture with multiple jsx files that works across adobe applications? Any good source for reading about this? 

 

Would love to learn more about how this works and what the "best practices" are for bigger code bases. 

 

Thanks,

Mike

    This topic has been closed for replies.

    2 replies

    Ten A
    Community Expert
    Community Expert
    July 27, 2020

    You can set the DispatchInfo element's Host attribute in your manifest.xml.
    Here is a typical structure.

    <Extension Id="com.example.testExtension">
    <DispatchInfo Host="ILST">
    <Resources>
    <MainPath>./index_ai.html</MainPath>
    <ScriptPath>./jsx/ai_extScript.jsx</ScriptPath>
    </Resources>
    ・
    ・
    ・
    </DispatchInfo>
    <DispatchInfo Host="IDSN">
    <Resources>
    <MainPath>./index_id.html</MainPath>
    <ScriptPath>./jsx/id_extScript.jsx</ScriptPath>
    </Resources>
    ・
    ・
    ・
    </DispatchInfo>

     

    Inspiring
    July 20, 2020

    I managed to solve my issue.. it was an error on my end that happened when I refactored my code.

     

    Question still stands though, would love to hear how you guys structure your code for larger projects.Since some/alot of code might just be revelant to specific apps I imagine being able to just load code that's relevant is what's preffered. 

     

    Does anyone use a pipeline including something like webpack for bulding and packaging?

     

    Is there any articles written on the subject?