Gulp can't build ES6 javascript

Ghost version: 3.14.0
Config: Hosted on DigitalOcean droplet, with nginx and docker-compose

What errors or information do you see in the console:
I downloaded the Lyra theme, and tried to edit the css and js files. I wanted to rebuild to get the latest css and js files in the built folder, but it appears that gulp does not support ES6 ES2015 javascript.

In this case, the error occurs using the string template literal in ES6, which I used to create a table of contents javascript file.

Error is depicted in the image below:
Gulp error

What steps could someone else take to reproduce the issue you’re having?
Download a theme, add in javascript files using ES6 syntax into the js folder. Run yarn dev to build.

How can I change the gulp file to build ES6 javascript, or will this be supported in future releases of Lyra? Thank you.

Hey @chenningg

You’re free to change the gulp version and dependencies so you can use ES6 in your customised theme. Gulp is merely used to manage assets within the theme, it can be entirely configured to your needs. You’ll probably need to use something gulp-babel to compile the JavaScript from ES6 files.

I found this article which might be a good starting point for you use case :blush:

1 Like

I’ll check it out! Meanwhile, will there be support for the “default” gulpfile to include ES6 support in the near future for the supported themes of Casper and Lyra?

Not that I’m aware of. As I said it’s best to customise the theme for your use case :blush: