Skip to content
This repository has been archived by the owner on Feb 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #102 from Turbo87/module-paths
Browse files Browse the repository at this point in the history
Add support for importing from `ember-cli-htmlbars-inline-precompile`
  • Loading branch information
rwjblue committed Mar 22, 2018
2 parents 8c7f927 + f33b729 commit 19a5f95
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/ast-plugins.js
Expand Up @@ -49,7 +49,8 @@ module.exports = {
precompile.baseDir = () => path.resolve(__dirname, '..');
precompile.cacheKey = () => cacheKey;

precompileInlineHTMLBarsPlugin = [HTMLBarsInlinePrecompilePlugin, { precompile }];
let modulePaths = ['ember-cli-htmlbars-inline-precompile', 'htmlbars-inline-precompile'];
precompileInlineHTMLBarsPlugin = [HTMLBarsInlinePrecompilePlugin, { precompile, modulePaths }];
pluginCache[cacheKey] = precompileInlineHTMLBarsPlugin;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -50,7 +50,7 @@
"ember-cli"
],
"dependencies": {
"babel-plugin-htmlbars-inline-precompile": "^0.2.3",
"babel-plugin-htmlbars-inline-precompile": "^0.2.4",
"ember-cli-version-checker": "^2.0.0",
"hash-for-dep": "^1.0.2",
"heimdalljs-logger": "^0.1.7",
Expand Down
7 changes: 7 additions & 0 deletions tests/unit/components/inline-precompilation-test.js
@@ -1,4 +1,5 @@
import hbs from 'htmlbars-inline-precompile';
import hbs2 from 'ember-cli-htmlbars-inline-precompile';
import { moduleForComponent, test } from 'ember-qunit';

moduleForComponent('inline-precompilation', {
Expand All @@ -10,3 +11,9 @@ test('using `hbs` tagged string places the precompiled template', function(asser

assert.equal(this.$().text().trim(), "greeting: hello from view", "inline precompile of the HTMLBars template works");
});

test('using `hbs` tagged string from `ember-cli-htmlbars-inline-precompile` replaces the precompiled template', function(assert) {
this.render(hbs2`{{inline-precompilation}}`);

assert.equal(this.$().text().trim(), "greeting: hello from view", "inline precompile of the HTMLBars template works");
});
6 changes: 3 additions & 3 deletions yarn.lock
Expand Up @@ -486,9 +486,9 @@ babel-plugin-eval@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/babel-plugin-eval/-/babel-plugin-eval-1.0.1.tgz#a2faed25ce6be69ade4bfec263f70169195950da"

babel-plugin-htmlbars-inline-precompile@^0.2.3:
version "0.2.3"
resolved "https://registry.yarnpkg.com/babel-plugin-htmlbars-inline-precompile/-/babel-plugin-htmlbars-inline-precompile-0.2.3.tgz#cd365e278af409bfa6be7704c4354beee742446b"
babel-plugin-htmlbars-inline-precompile@^0.2.4:
version "0.2.4"
resolved "https://registry.yarnpkg.com/babel-plugin-htmlbars-inline-precompile/-/babel-plugin-htmlbars-inline-precompile-0.2.4.tgz#54b48168432bbc03f1f26f2e9090cb222bc78c75"

babel-plugin-inline-environment-variables@^1.0.1:
version "1.0.1"
Expand Down

0 comments on commit 19a5f95

Please sign in to comment.