Search code examples
javascriptminify

Grave accent char ` causes an error an when is minified


I want to minify my javascript but I have this error due to special chars used in multi line strings:

var string = `hello`;

This char ` is known as *Grave accent

Result:

enter image description here

I tried several web tools and I had the same errors:

Question

How can I replace this character so that it can be minified?

I will try with some shell tool at the moment.

Thanks

Updated

This is a more real snippet:

var cssText = `
position:absolute;
width:500px;
height:${some_var}px;
top:60px;
left:35px;
color:greenyellow;
padding: 5px;
`;

Solution

  • Here are a couple tools that seem to do what you want