Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/joernberkefeld/sfmc-boilerplate

automatically bundle your scripts for deployment
https://github.com/joernberkefeld/sfmc-boilerplate

deployment devops exacttarget marketing-cloud salesforce sfmc sfmc-boilerplate sfmc-build

Last synced: 2 months ago
JSON representation

automatically bundle your scripts for deployment

Awesome Lists containing this project

README

        

# SFMC Boilerplate

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

[![NPM](https://nodei.co/npm/sfmc-boilerplate.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/sfmc-boilerplate/)

## Installation

```batch
> 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.

```json
{
"name": "name of your page or email",
"author": "[email protected]",
"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": ""
}
}
}
```

| Parameter | Description |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| ``name`` | identifies how the page or email is called in SFMC |
| ``author`` | name or email of author |
| ``server.coreVersion`` | this is used to insert "Platform.Load("core", "x.x.x");" before any SSJS code |
| ``server.scriptAttributes`` | define any attributes you want to see on auto-inserted ```` tags for SSJS |
| ``server.dependencies`` | put any re-usable libraries that you will not modifiy as part of the current app here |
| ``server.dependencies.ssjs`` | all SSJS lib files; code will be wrapped in one single ``<script runat="server">...`` |
| ``server.dependencies.other`` | any non-SSJS lib files (HTML, AMP, mixed); no wrapping code will be added |
| ``server.src`` | this is where your server-side app goes. You can use multipe files as well if needed |
| ``public`` | list your front end files here; any type is supported. JS & CSS will be autowrapped in their own ```` / ``<style>`` nodes |
| ``dest`` | define the path and file name of your output file. The path is relative to the ``cloudpage.json`` |
| ``template`` | allows you to do string replacements and will output dedicated bundles per template |

## License

MIT licensed