How to use the vue-native-scripts/src/util/constants.TEMPLATE_RENDER function in vue-native-scripts

To help you get started, we’ve selected a few vue-native-scripts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github syumai / vue-native-custom-transformer-plugin / compiler / parsers / parseTemplate.js View on Github external
const compiler = require('vue-native-template-compiler');
const constants = require('vue-native-scripts/src/util/constants');

let pug;

try {
  pug = require('pug');
} catch (e) {
  console.log('pug not loaded');
}

const defaultTemplate = {
  import: `import { Component as ${constants.COMPONENT} } from 'react'`,
  render: `const ${constants.TEMPLATE_RENDER} = () => null`,
};

function transpileTemplateContent(content, lang) {
  if (lang === 'pug') {
    if (pug) {
      return pug.render(content);
    } else {
      throw new Error(`failed to load pug! please add pug as a dependency.`);
    }
  }
  return content;
}

function parseTemplate(template) {
  if (!template) {
    return defaultTemplate;

vue-native-scripts

Compile Vue Native components to React Native

MIT
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis

Similar packages