@codemod-utils/ast-template
Version:
Utilities for handling *.hbs files as abstract syntax tree
45 lines (23 loc) • 1.07 kB
Markdown
[](https://github.com/ijlee2/codemod-utils/actions/workflows/ci.yml)
_Utilities for handling `*.hbs` files as abstract syntax tree_
`@codemod-utils/ast-template` provides methods from [`ember-template-recast`](https://github.com/ember-template-lint/ember-template-recast) to help you parse and transform `*.hbs` files.
```ts
import { AST } from '@codemod-utils/ast-template';
function transform(file: string): string {
const traverse = AST.traverse();
const ast = traverse(file, {
/* Use AST.builders to transform the tree */
});
return AST.print(ast);
}
```
Visit https://codemod-utils.netlify.app/docs/packages/codemod-utils-ast-template.
- Node.js v22 or above
See the [Contributing](../../../CONTRIBUTING.md) guide for details.
This project is licensed under the [MIT License](./LICENSE.md).