Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: inline glimmer component templates #2

Open
jamesarosen opened this issue Sep 18, 2017 · 2 comments
Open

Feature request: inline glimmer component templates #2

jamesarosen opened this issue Sep 18, 2017 · 2 comments

Comments

@jamesarosen
Copy link

jamesarosen commented Sep 18, 2017

Glimmer doesn't seem to support inlining component templates. I've tried

import Component from '@glimmer/component';
import hbs from '@glimmer/inline-precompile';

export default class Welcome extends Component {
  layout = hbs`<div><h1>Welcome to Glimmer!</h1></div>`
}

and variants thereon.

The issue seems to be that the rendering environment doesn't have access to the component instance, so it can't look up the compiled template. This will likely require coordination between this project and glimmerjs/glimmer.js.

@yads
Copy link

yads commented Mar 2, 2021

This would also be great for certain testing scenarios.

@privatenumber
Copy link

This should be possible with something like this:

import templateOnly from '@ember/component/template-only';
import { setComponentTemplate } from '@ember/component';
import { hbs } from 'ember-cli-htmlbars';

export default setComponentTemplate(
	hbs`<div>inline template!</div>`,
	templateOnly(),
);

setComponentTemplate RFC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants