Search code examples
demandware

External library in DW


I'm new to demandware. What I'm trying to do is add an external library to use in DW Controllers.

in short: How to use an external library as lodash in demandware controller?


Solution

  • Demandware is using the Rhino engine under the hood, which typically isn't compatible with the latest libraries. To use a third party library in Demandware, try these steps:

    1. Create a new blank cartridge
    2. Copy paste the library's code
    3. Try to use it. If it is a really simple library it might work out of the box. Most likely however, you'll have to make code adjustments. Dive into the error logs to see what goes wrong.
    4. If the library has dependencies, you'll need to fix those as well.