Skip to content

Haroenv/dedent.macro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

dedent.macro

A babel macro for dedent

Usage

Setting up babel macros

yarn add babel-plugin-macros

.babelrc

{
  "plugins": ["macros"]
}

See more info in the main documentation

Setting up dedent.macro

yarn add --dev dedent.macro
import dedent from 'dedent.macro'

    dedent`
    hi there
    this is fine
    `

This will transform out the leading spaces, just like regular Dedent usage would, but with the difference being that the dedent call will be transformed out completely during the babel process.