-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #162 from patricklx/content-tag
- Loading branch information
Showing
25 changed files
with
5,380 additions
and
2,939 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
# The Plan | ||
|
||
1. Run `preprocessEmbeddedTemplates` from ember-template-imports to convert gjs files with `<template>` tags into valid JS. The `<template>` tag gets converted into something like `[__GLIMMER_TEMPLATE('<h1> Hello </h1>', { strictMode: true })]`. | ||
1. Run the `estree` Prettier printer, which formats the valid JS above. | ||
1. Grab template contents from `GLIMMER_TEMPLATE` AST node described above. | ||
1. Run the hbs Prettier printer against the template contents. | ||
1. Replace the `GLIMMER_TEMPLATE` AST node with the results from above, wrapped in `<template>`, like so: | ||
1. Run `Preprocessor.parse` from content-tag to get template locations. manually convert gjs files with `<template>` tags into valid JS, which doesn't change location. The `<template>` tag gets converted into empty strings. | ||
2. convert empty string to a custom `Template` Ast node, which holds the template content. | ||
3. Run the `estree` Prettier printer, which formats the valid JS above. | ||
4. Grab template contents from `Template` AST node described above. | ||
5. Run the hbs Prettier printer against the template contents. | ||
6. Replace the `Template` AST node with the results from above, wrapped in `<template>`, like so: | ||
|
||
```gts | ||
<template> | ||
<h1>Hello</h1> | ||
</template> | ||
``` | ||
|
||
Unfortunately, this will likely involve either monkey-patching or re-implementing the estree printer due to this issue: https://github.com/prettier/prettier/issues/10259 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.