How to use vue-native-template-compiler - 5 common examples

To help you get started, we’ve selected a few vue-native-template-compiler 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 GeekyAnts / vue-native-core / packages / vue-native-scripts / build.js View on Github external
function compileVueToRn(resource) {
  var code = resource.toString();
  var cparsed = compiler.parseComponent(code, { pad: 'line' });

  var output = '';
  var mappings = '';

  // add react-vue import
  output += "import " + (constants.VUE) + ", { observer as " + (constants.OBSERVER) + " } from 'vue-native-core'";
  output += '\n';

  // // add react import
  // output += `import ${constants.REACT} from 'react'`
  // output += '\n';

  // add react-native import
  output += "import " + (constants.REACT_NATIVE) + " from 'react-native'";
  output += '\n';
github GeekyAnts / vue-native-core / src / platforms / vue-native / scripts / compiler.js View on Github external
export function compileVueToRn(resource) {
  const code = resource.toString();
  const cparsed = compiler.parseComponent(code, { pad: 'line' });

  let output = '';
  let mappings = '';

  // add react-vue import
  output += `import ${constants.VUE}, { observer as ${
    constants.OBSERVER
    } } from 'vue-native-core'`;
  output += '\n';

  // // add react import
  // output += `import ${constants.REACT} from 'react'`
  // output += '\n';

  // add react-native import
  output += `import ${constants.REACT_NATIVE} from 'react-native'`;
github GeekyAnts / vue-native-core / src / platforms / vue-native / scripts / compiler.js View on Github external
function parseTemplate(code) {
  const obj = compiler.nativeCompiler(code);
  return {
    import: obj.importCode,
    render: `const ${constants.TEMPLATE_RENDER} = ${obj.renderCode}`
  };
}
github GeekyAnts / vue-native-core / packages / vue-native-scripts / build.js View on Github external
function parseTemplate(code) {
  var obj = compiler.nativeCompiler(code);
  return {
    import: obj.importCode,
    render: ("const " + (constants.TEMPLATE_RENDER) + " = " + (obj.renderCode))
  };
}
github syumai / vue-native-custom-transformer-plugin / compiler / parsers / parseTemplate.js View on Github external
function parseTemplate(template) {
  if (!template) {
    return defaultTemplate;
  }

  const { content, lang } = template;
  const trimmedContent = content.replace(/\/\/\n/g, '');
  const transpiledContent = transpileTemplateContent(trimmedContent, lang);
  if (transpiledContent) {
    const obj = compiler.nativeCompiler(transpiledContent);
    return {
      import: obj.importCode,
      render: `const ${constants.TEMPLATE_RENDER} = ${obj.renderCode}`,
    };
  }
}

vue-native-template-compiler

Vue Native template compiler, dependency of vue-native-scripts. It can also be used as a stand-alone compiler

MIT
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis