🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

sfmc-boilerplate

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sfmc-boilerplate

set up local dev env for Salesforce Marketing Cloud and create deployment bundles

latest
Source
npmnpm
Version
1.2.7
Version published
Maintainers
1
Created
Source

SFMC Boilerplate

bundle your scripts for Cloudpages & E-Mails easily and automated

NPM

Installation

> npm install --save-dev sfmc-boilerplate

Usage

run npx sfmc-build in the root of your project to see all available commands.

Config files (email.json / cloudpage.json)

This required file is used to specify loading order and other details for compiling your code. Place it inside of each folder where you keep the source files for one email or one cloudpage.

{
    "name": "name of your page or email",
    "author": "joern.berkefeld@some-mail.com",
    "server": {
        "coreVersion": "1.1.1",
        "scriptAttributes": {
            "executioncontexttype": "post"
        },
        "dependencies": {
            "other": ["server/lib/lib.something.html"],
            "ssjs": ["server/lib/lib.ab.ssjs", "server/lib/lib.cd.ssjs"]
        },
        "src": ["server/server.ssjs"]
    },
    "public": ["public/index.html", "public/style.css", "public/app.js"],
    "dest": "dist/bundle.html",
    "template": {
        "DEV":{
        },
        "QA": {
            "_DEV": "_QA"
        },
        "PROD": {
            "_DEV": ""
        }
    }
}
ParameterDescription
nameidentifies how the page or email is called in SFMC
authorname or email of author
server.coreVersionthis is used to insert "Platform.Load("core", "x.x.x");" before any SSJS code
server.scriptAttributesdefine any attributes you want to see on auto-inserted <script> tags for SSJS
server.dependenciesput any re-usable libraries that you will not modifiy as part of the current app here
server.dependencies.ssjsall SSJS lib files; code will be wrapped in one single <script runat="server">...</script>
server.dependencies.otherany non-SSJS lib files (HTML, AMP, mixed); no wrapping code will be added
server.srcthis is where your server-side app goes. You can use multipe files as well if needed
publiclist your front end files here; any type is supported. JS & CSS will be autowrapped in their own <script> / <style> nodes
destdefine the path and file name of your output file. The path is relative to the cloudpage.json
templateallows you to do string replacements and will output dedicated bundles per template

License

MIT licensed

Keywords

ssjs

FAQs

Package last updated on 14 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts