|
4 | 4 |
|
5 | 5 | ## Compatibility |
6 | 6 |
|
7 | | -* Ember.js v3.8 or above |
8 | | -* Ember CLI v3.8 or above |
9 | | -* Node.js v12 or above |
10 | | - |
11 | | -## Tagged Template Usage / Migrating from `htmlbars-inline-precompile` |
12 | | - |
13 | | -Starting with version 4.0, this addon now includes the testing helper from [ember-cli-htmlbars-inline-precompile](https://github.com/ember-cli/ember-cli-htmlbars-inline-precompile) |
14 | | - |
15 | | -This will require an update to the imports of the `hbs` helper in your tests: |
16 | | - |
17 | | -Prior syntax: |
18 | | - |
19 | | -``` |
20 | | -import hbs from 'htmlbars-inline-precompile'; |
21 | | -
|
22 | | -... |
23 | | -
|
24 | | -await render(hbs` |
25 | | - <MyComponent /> |
26 | | -`); |
27 | | -``` |
28 | | - |
29 | | -New syntax: |
30 | | - |
31 | | -``` |
32 | | -import { hbs } from 'ember-cli-htmlbars'; |
33 | | -
|
34 | | -... |
35 | | -
|
36 | | -await render(hbs` |
37 | | - <MyComponent /> |
38 | | -`); |
39 | | -``` |
40 | | - |
41 | | -There is a [codemod](https://github.com/ember-codemods/ember-cli-htmlbars-inline-precompile-codemod) available to automate this change. |
42 | | - |
43 | | -## Additional Trees |
44 | | - |
45 | | -For addons which want additional customizations, they are able to interact with |
46 | | -this addon directly. |
47 | | - |
48 | | -```ts |
49 | | -interface EmberCLIHTMLBars { |
50 | | - /** |
51 | | - Supports easier transpilation of non-standard input paths (e.g. to transpile |
52 | | - a non-addon NPM dependency) while still leveraging the logic within |
53 | | - ember-cli-htmlbars for transpiling (e.g. custom AST transforms, colocation, etc). |
54 | | - */ |
55 | | - transpileTree(inputTree: BroccoliTree): BroccoliTree; |
56 | | -} |
57 | | -``` |
58 | | - |
59 | | -### `transpileTree` usage |
60 | | - |
61 | | -```js |
62 | | -// find the ember-cli-htmlbars addon |
63 | | -let htmlbarsAddon = this.addons.find(addon => addon.name === 'ember-cli-htmlbars'); |
64 | | - |
65 | | -// invoke .transpileTree passing in the custom input tree |
66 | | -let transpiledCustomTree = htmlbarsAddon.transpileTree(someCustomTree); |
67 | | -``` |
| 7 | +* Ember.js v4.12 or above |
| 8 | +* Ember CLI v4.12 or above |
| 9 | +* `@embroider/compat` 3.4.3 or above (optional) |
| 10 | +* Node.js v18 or above |
68 | 11 |
|
69 | 12 | ## Adding Custom Plugins |
70 | 13 |
|
@@ -141,28 +84,6 @@ export interface ASTPluginWithDeps extends ASTPlugin { |
141 | 84 | } |
142 | 85 | ``` |
143 | 86 |
|
144 | | -## Precompile HTMLBars template strings within other addons |
145 | | - |
146 | | -```javascript |
147 | | -module.exports = { |
148 | | - name: 'my-addon-name', |
149 | | - |
150 | | - setupPreprocessorRegistry: function(type, registry) { |
151 | | - var htmlbarsPlugin = registry.load('template').find(function(plugin) { |
152 | | - return plugin.name === 'ember-cli-htmlbars'; |
153 | | - }); |
154 | | - |
155 | | - // precompile any htmlbars template string via the precompile method on the |
156 | | - // ember-cli-htmlbars plugin wrapper; `precompiled` will be a string of the |
157 | | - // form: |
158 | | - // |
159 | | - // Ember.HTMLBars.template(function() {...}) |
160 | | - // |
161 | | - var precompiled = htmlbarsPlugin.precompile("{{my-component}}"); |
162 | | - } |
163 | | -}; |
164 | | -``` |
165 | | - |
166 | 87 | ### Custom Template Compiler |
167 | 88 |
|
168 | 89 | You can still provide a custom path to the template compiler (e.g. to test |
|
0 commit comments