Skip to content

Releases: rmorse/babel-plugin-jsx-template-vars

v0.0.9

07 Aug 19:39
a782eb5

Choose a tag to compare

What's new:

  • Greatly improved control variables
    • Now supports any order of parameters in statements, eg:
      'yes' === myControlVar as well as myControlVar === 'no'
    • Ability to combine template vars in statements, eg:
      myControlTemplateVar !== anotherControlTemplateVar
    • Support for ternary expressions and nested ternary expressions such as:
      const className = 'input--type-' + ( multiple ? 'multiple' : 'single' )
      Works for variable assignment in the component block statement as well as when used directly in JSX output:
      <>{ 'Is type: ' + ( multiple ? 'multiple' : 'single' ) }</>
    • Added all the above logic for for statements in JSX expressions, eg:
      { myTemplateVar === anotherTemplateVar && 'Some output' }
  • Reworked language files to be more readable, eg, instead of ||%1|| now use [%_variable_]
    • Notice this change is not backwards compatible and requires remaking your language files (if using custom language files)
    • Added custom variables to languages (check the PHP language file) - these can be used like:
      [%myVariableName]

v0.0.8

19 Jun 18:37
c48ba0f

Choose a tag to compare

What's new:

  • Reworked language injection and custom languages
    • Add support for .tvlang config file to define custom language
    • Moved custom languages + logic into client application
    • Use .json format for language definition
    • Supply path to a custom language location
  • Enable support for multiple levels of nested components (in .map())
    • Use contexts in client side application to track depth
    • Generate variable names based on depth
  • Use traverse to locate component path rather than assuming it was the previous sibling from the .templateVars definition
  • Fix issues with quotation marks being encoded in output - use only single quotes in language definitions (this is enforced by using json as the language format)

v0.0.5

22 May 16:18
05fb5b9

Choose a tag to compare

What's new:

  • Added support for the PHP language
  • Expose language choice via babel config
  • Add support for custom language definitions
  • Updated readme and added docs to the Wiki .

v0.0.4

18 May 19:44
73fd030

Choose a tag to compare

v.0.0.4

  • supports list vars and .map() in JSX expressions
  • supports flat arrays using primitives
  • fixes listvars + control vars when used together (list vars were not being wrapped in template tags when used in expressions using control vars)
  • add full example to the readme