0.2.1 • Published 4 years ago
@jzendo/babel-plugin-transform-template-literals v0.2.1
@jzendo/babel-plugin-transform-template-literals
Support stripForeAndAftLinebreaks
option
stripForeAndAftLinebreaks:
"none" // None
"all" // Strip all fore-and-aft /^[\n|\t|\s]+|[\n|\t|\s]+$/
"default" // Strip only one fore-and-aft /^[\n]|[\n]$/
babel.config.js/.babelrc
configuration
{
plugins: [
[
require('@jzendo/babel-plugin-transform-template-literals'),
{
// ['none', 'default', 'all'], default: 'default'
stripForeAndAftLinebreaks: 'none'
}
]
]
}
Samples
stripForeAndAftLinebreaks: none
/** ES6 */
let a = `
abc
`
/** ES5 */
var a = '\n\nabc\n'
stripForeAndAftLinebreaks: default
/** ES6 */
let a = `
abc
`
/** ES5 */
var a = '\nabc'
stripForeAndAftLinebreaks: all
/** ES6 */
let a = `
abc
`
/** ES5 */
var a = 'abc'
Using plugin
npm install -D @jzendo/babel-plugin-transform-template-literals
or
yarn add -D @jzendo/babel-plugin-transform-template-literals
Fork: https://github.com/babel/babel/tree/v7.8.6/packages/babel-plugin-transform-template-literals
@babel/plugin-transform-template-literals
Compile ES2015 template literals to ES5
See our website @babel/plugin-transform-template-literals for more information.
Install
Using npm:
npm install --save-dev @babel/plugin-transform-template-literals
or using yarn:
yarn add @babel/plugin-transform-template-literals --dev