babel-plugin-lodash-template-compile
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Babel Plugin Lodash Template Compile

Babel plugin for compiling lodash templates at compile-time, rather than run-time.

Install

npm install --save-dev babel-plugin-lodash-template-compile

Usage

Add this plugin to your babel plugins:

  plugins[
    ['babel-plugin-lodash-template-compile', { /* plugin options */ }]
  ]

This plugin supports the following options:

{
  minify?: boolean, // Whether to minify the compiled template or not
  data?: any, // If provided the templates will be rendered to HTML directly using this data
  templateOptions?: {} // All options supported by `lodash.template`
}

This plugin will compile lodash templates written like so at compile-time, so that your app won't waste time on this at run-time:

_.template ( '<%= obj.value %>' );
_.template ( "<%= obj.value %>" );
_.template ( `<%= obj.value %>` );
lodash.template ( '<%= obj.value %>' );
lodash.template ( "<%= obj.value %>" );
lodash.template ( `<%= obj.value %>` );

Other ways to use lodash's template function aren't currently supported.

License

MIT © Fabio Spampinato

/babel-plugin-lodash-template-compile/

    Package Sidebar

    Install

    npm i babel-plugin-lodash-template-compile

    Weekly Downloads

    44

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    11.9 kB

    Total Files

    14

    Last publish

    Collaborators

    • fabiospampinato