How to use the @aurelia/plugin-conventions.preprocess function in @aurelia/plugin-conventions

To help you get started, we’ve selected a few @aurelia/plugin-conventions 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 aurelia / aurelia / packages / __tests__ / plugin-conventions / preprocess.spec.ts View on Github external
it('transforms html file', function () {
    const html = '<template></template>';
    const expected = `import { CustomElement } from '@aurelia/runtime';
export const name = "foo-bar";
export const template = "<template></template>";
export default template;
export const dependencies = [  ];
let _e;
export function getHTMLOnlyElement() {
  if (!_e) {
    _e = CustomElement.define({ name, template, dependencies });
  }
  return _e;
}
`;
    const result = preprocess({ path: path.join('src', 'foo-bar.html'), contents: html }, {}, () =&gt; false);
    assert.equal(result.code, expected);
    assert.equal(result.map.version, 3);
  });

@aurelia/plugin-conventions

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/) [![CircleCI](https://circleci.com/

MIT
Latest version published 2 months ago

Package Health Score

84 / 100
Full package analysis