---
title: "Use ECMAScript 6+ in your theme"
slug: "use-ecmascript-6--in-your-theme"
abstract: "Make ECMAScript 6+ code work."
---
# Use ECMAScript 6+ in your theme

To prevent having cross-browser JavaScript problems, SXA comes with an ES watcher. This way, developers can use ECMAScript 6+ in their code, and also make it work in older browsers. ECMAScript 6+ code in the `sources` folder is automatically converted file to a file in the `scripts` folder to offer fallback functionality in older browsers.

To add an ECMAScript 6+ script class:

1. Store ECMAScript 6+  code in the `sources` folder of your theme: `Media Library/MyTheme/sources`

    ![Add an ECMAScript 6+ class.](https://doc.sitecore.com/api/markdown-image/xp/en/developers/sxa/105/sitecore-experience-accelerator/images/SXA-ECMA-source.png)

2. Start the default gulp task. The ES watcher now ensures that any ECMAScript 6+ code in the source folder are transformed to JavaScript code and saved in the `scripts` folder.

    ![ECMAScript code saved as JS code in the scripts folder.](https://doc.sitecore.com/api/markdown-image/xp/en/developers/sxa/105/sitecore-experience-accelerator/images/SXA-ECMA-scripts.png)