Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

Commit

Permalink
[FEAT] Adds isProduction flag
Browse files Browse the repository at this point in the history
This flag allows the template compiler to have different behavior
in production vs development builds.
  • Loading branch information
Chris Garrett committed Aug 5, 2020
1 parent 7cb6e42 commit e936f44
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ module.exports = function (babel) {

let template = path.node.quasi.quasis.map((quasi) => quasi.value.cooked).join('');

path.replaceWith(compileTemplate(state.opts.precompile, template));
let { precompile, isProduction } = state.opts;

path.replaceWith(compileTemplate(precompile, template, { isProduction }));
},

CallExpression(path, state) {
Expand Down Expand Up @@ -195,6 +197,7 @@ module.exports = function (babel) {

switch (args.length) {
case 1:
options = {};
break;
case 2: {
if (args[1].type !== 'ObjectExpression') {
Expand All @@ -213,7 +216,9 @@ module.exports = function (babel) {
);
}

let { precompile } = state.opts;
let { precompile, isProduction } = state.opts;

options.isProduction = isProduction;

path.replaceWith(compileTemplate(precompile, template, options));
},
Expand Down

0 comments on commit e936f44

Please sign in to comment.