# Expressions configuration

Expressions may be configured in your project's `config.js`:

```js [config.js]
export default {
  expressions: {
    // ...
  }
}
```

## delimiters

Type: `Array`<br />


Default: `['{{', '}}']`

Array containing beginning and ending delimiters for expressions.

It's common for templating engines (like those used by email service providers) to use `{{` and `}}` as delimiters. You may change the ones Maizzle uses in order to avoid conflicts:

```js [config.js]
export default {
  expressions: {
    delimiters: ['[[', ']]'],
  }
}
```

## unescapeDelimiters

Type: `Array`<br />


Default: `['{{{', '}}}']`

Array containing beginning and ending delimiters for unescaped locals.

You'd normally use these when you want to output HTML from a variable without escaping it:

```html
{{ '<span>escaped</span>' }}
{{{ '<span>unescaped</span>' }}}
```

Result:

```html
&lt;span&gt;escaped&lt;/span&gt;
<span>unescaped</span>
```

## locals

Type: `Object`<br />


Default: `{}`

Variables defined here will be available 'locally', meaning you won't need to use the `page` object when accessing them.

For example, if you set this to something like `{foo: 'bar'}`, you can access it in your templates through `{{ foo }}` instead of `{{ page.foo }}`.

## localsAttr

Type: `String`<br />


Default: `locals`

Attribute name for `<script>` tags that contain locals.

Imagine you'd write `<script vars>` instead of `<script locals>` to define variables in your templates. You can change the attribute name like this:

```js [config.js]
export default {
  expressions: {
    localsAttr: 'vars',
  }
}
```

Then, you'd use it like this:

```hbs [example.html]
<script vars>
  module.exports = {
    foo: "bar"
  }
</script>

{{ foo }}
```

## removeScriptLocals

Type: `Boolean`<br />


Default: `false`

Whether to remove `<script>` tags that contain locals.

## conditionalTags

Type: `Array`<br />


Default: `['if', 'elseif', 'else']`

Array containing tag names to be used for [if/else statements](/docs/tags/#conditionals).

## switchTags

Type: `Array`<br />


Default: `['switch', 'case', 'default']`

Array containing tag names to be used for [switch statements](/docs/tags/#switch).

## loopTags

Type: `Array`<br />


Default: `['each', 'for']`

Array containing tag names to be used for [loops](/docs/tags/#loops).

## scopeTags

Type: `Array`<br />


Default: `['scope']`

Array containing tag names to be used for [scopes](/docs/tags/#scope).

## ignoredTag

Type: `String`<br />


Default: `raw`

Name of tag inside of which expression parsing is disabled.

Besides `{{ }}` expressions, the following tags will be ignored and output as-is:

- conditional tags (if/elseif/else)
- switch tags (switch/case/default)
- loop tags (each/for)
- scope tags (scope)

## strictMode

Type: `Boolean`<br />


Default: `false`

Maizzle disables `strictMode` so that if you have an error inside an expression, it will be rendered as `undefined` and the email will still be compiled, instead of the build failing.

## missingLocal

Type: `undefined|String`<br />


Default: `{local}`

Define what to render when referencing a value that is not defined in `locals`.

<table>
<thead>
  <tr>
    <th align="center">
      missingLocal
    </th>
    
    <th align="center">
      strictMode
    </th>
    
    <th align="left">
      Output
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td align="center">
      <code>
        undefined
      </code>
    </td>
    
    <td align="center">
      <code>
        true
      </code>
    </td>
    
    <td align="left">
      Error is thrown
    </td>
  </tr>
  
  <tr>
    <td align="center">
      <code>
        undefined
      </code>
    </td>
    
    <td align="center">
      <code>
        false
      </code>
    </td>
    
    <td align="left">
      <code>
        undefined
      </code>
      
       (string)
    </td>
  </tr>
  
  <tr>
    <td align="center">
      <code>
        ''
      </code>
    </td>
    
    <td align="center">
      <code>
        false
      </code>
      
      /<code>
        true
      </code>
    </td>
    
    <td align="left">
      <code>
        ''
      </code>
      
       (empty string)
    </td>
  </tr>
  
  <tr>
    <td align="center">
      <code>
        {local}
      </code>
    </td>
    
    <td align="center">
      <code>
        false
      </code>
      
      /<code>
        true
      </code>
    </td>
    
    <td align="left">
      Original reference like <code>
        {{ foo }}
      </code>
    </td>
  </tr>
</tbody>
</table>

By default, Maizzle will output the string the original reference as a string, i.e. `{{ foo }}`, when a value is not defined.
