1

Does anyone know of a way to convert JavaScript Template Literals back to String Concatenation?

Why you ask? Google App Script came out with a new es6 debugger that broke after 3 months and the only way to continue developing is to go back to es5 and use the old debugger. I've seen es-linting that can convert string concats to template literals but I can't find anything for converting to the other way.

JasonTheLucky
  • 177
  • 11
  • 3
    Babel? Maybe there's an ESLint auto-fixer that removes template literals? – CertainPerformance Aug 30 '20 at 01:26
  • 1
    If you want to directly update the Google Apps Script, when the GAS project is the standalone type, Drive API is required to be used. When the GAS project is the container-bound script, it is required to use Google Apps Script API. By this, you can retrieve the script of GAS and updating the GAS project. At that time, when you retrieve the Google Apps Script, you can convert for achieving your goal using other script as commented by @CertainPerformance. And, the converted script can be uploaded by updating GAS project. – Tanaike Aug 30 '20 at 01:51
  • One other note - why is that your only choice to continue developing is reverting to the old runtime? – Oleg Valter is with Ukraine Aug 30 '20 at 03:28
  • 2
    Debugger Issue fixed: https://stackoverflow.com/questions/63058299 – TheMaster Sep 01 '20 at 17:04

1 Answers1

1

Solution

You will have to use Babel in order to transpile JavaScript es6. Since to use Babel in your Apps Script project you will have to work on your local machine, you can use the clasp interface to do so.

Reference

Clasp

Alessandro
  • 2,848
  • 1
  • 8
  • 16