babel-plugin-transform-string-join
Babel plugin that will join strings and template strings in compilation time whenever it's possible.
Examples
Array.proptotype.join
You can use Array.proptotype.join
to join list of strings and template strings together.
In
const className = 'container';const html = `<div class=>` '<span>Hello World</span>' '</div>';
Out
const html = `<div class=><span>Hello World</span></div>`;
String addition
Also, you can use +
to simply concat strings and template strings together.
In
const className = 'container';const html = `<div class=>` + '<span>Hello World</span>' + '</div>';
Out
const html = `<div class=><span>Hello World</span></div>`;
Installation
$ npm install babel-plugin-transform-string-join
Usage
.babelrc
(Recommended)
Via .babelrc
Via CLI
$ babel --plugins transform-string-join script.js
Via Node API
;
License
MIT