Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ jobs:
- ember-beta
- ember-canary
- embroider-safe
- embroider-optimized

steps:
- uses: actions/checkout@v3
Expand Down
87 changes: 4 additions & 83 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,67 +4,10 @@

## Compatibility

* Ember.js v3.8 or above
* Ember CLI v3.8 or above
* Node.js v12 or above

## Tagged Template Usage / Migrating from `htmlbars-inline-precompile`

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)

This will require an update to the imports of the `hbs` helper in your tests:

Prior syntax:

```
import hbs from 'htmlbars-inline-precompile';

...

await render(hbs`
<MyComponent />
`);
```

New syntax:

```
import { hbs } from 'ember-cli-htmlbars';

...

await render(hbs`
<MyComponent />
`);
```

There is a [codemod](https://github.com/ember-codemods/ember-cli-htmlbars-inline-precompile-codemod) available to automate this change.

## Additional Trees

For addons which want additional customizations, they are able to interact with
this addon directly.

```ts
interface EmberCLIHTMLBars {
/**
Supports easier transpilation of non-standard input paths (e.g. to transpile
a non-addon NPM dependency) while still leveraging the logic within
ember-cli-htmlbars for transpiling (e.g. custom AST transforms, colocation, etc).
*/
transpileTree(inputTree: BroccoliTree): BroccoliTree;
}
```

### `transpileTree` usage

```js
// find the ember-cli-htmlbars addon
let htmlbarsAddon = this.addons.find(addon => addon.name === 'ember-cli-htmlbars');

// invoke .transpileTree passing in the custom input tree
let transpiledCustomTree = htmlbarsAddon.transpileTree(someCustomTree);
```
* Ember.js v4.12 or above
* Ember CLI v4.12 or above
* `@embroider/compat` 3.4.3 or above (optional)
* Node.js v18 or above

## Adding Custom Plugins

Expand Down Expand Up @@ -141,28 +84,6 @@ export interface ASTPluginWithDeps extends ASTPlugin {
}
```

## Precompile HTMLBars template strings within other addons

```javascript
module.exports = {
name: 'my-addon-name',

setupPreprocessorRegistry: function(type, registry) {
var htmlbarsPlugin = registry.load('template').find(function(plugin) {
return plugin.name === 'ember-cli-htmlbars';
});

// precompile any htmlbars template string via the precompile method on the
// ember-cli-htmlbars plugin wrapper; `precompiled` will be a string of the
// form:
//
// Ember.HTMLBars.template(function() {...})
//
var precompiled = htmlbarsPlugin.precompile("{{my-component}}");
}
};
```

### Custom Template Compiler

You can still provide a custom path to the template compiler (e.g. to test
Expand Down
71 changes: 0 additions & 71 deletions lib/addDependencyTracker.js

This file was deleted.

13 changes: 3 additions & 10 deletions lib/colocated-babel-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,9 @@ module.exports = function (babel) {
let t = babel.types;

function makeSetComponentTemplateExpression(state) {
if (!state.opts.requiresModuleApiPolyfill) {
return state._colocationEnsureImport(
'setComponentTemplate',
'@ember/component',
);
}

return t.memberExpression(
t.identifier('Ember'),
t.identifier('_setComponentTemplate'),
return state._colocationEnsureImport(
'setComponentTemplate',
'@ember/component',
);
}

Expand Down
Loading