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

How can I write gjs / gts? #141

Open
NullVoxPopuli opened this issue Oct 3, 2022 · 7 comments
Open

How can I write gjs / gts? #141

NullVoxPopuli opened this issue Oct 3, 2022 · 7 comments

Comments

@NullVoxPopuli
Copy link
Contributor

I'd like to provide live demos of strict-mode templates in my docs.

Can I write gjs / gts?

@josemarluedke
Copy link
Owner

Currently, we don't have support for it, but a PR adding would be welcome.

@nicolechung
Copy link
Contributor

nicolechung commented Jan 30, 2023

How would this work (as someone who only knows a bit about gjs/gts?)

Would it be something like:

  1. install glint as dev dependencies
  2. modify lines like this one:
    if (chunk.ext === 'js' || chunk.ext === 'ts') {
  3. add a glint component to packages/ember/addon
  4. publish a glint demo?

@NullVoxPopuli
Copy link
Contributor Author

glint is totally separate from gjs/gts, but the gist would be

  1. install ember-template-imports peerDependencies entry
  2. not quite, there is no backing js with gjs/gts. it just... is.
    I really think we should switch to using the live tag here :
    if (['component', 'template', 'styles'].includes(node.meta || '')) {

    as I do here: https://jsbin.com/serolidome/1/edit?html,output
    gjs needs to be returned here:
    node.lang || (node.meta === 'template' ? 'hbs' : 'js')
    (or we use the live tag, and don't mess with that branch

Another option may be to just make a separate plugin for gjs/gts components using the liveCodeExtraction plugin I have in the jsbin

@nicolechung
Copy link
Contributor

So I tried copying over the code from above, and then adding this to the README in the dummy-docs:

{imagine backticks here}gjs live
<template>
Hello!
</template>
{/end imagine backticks here}

But I got the following error:

Error occurred:

- While rendering:
  -top-level
    application
      docs
        docs.index


There was an error running your app in fastboot. More info about the error:
 Error: Attempted to resolve `ember-repl8a6aa7086c6a5dfb-b99e0fc2d0433e37`, which was expected to be a component, but nothing was found.
    at resolveComponent (/var/folders/jc/81dkjn9s2sg5cpt_66jd8l640000gn/T/broccoli-19053Mj6xWKP11waW/out-206-broccoli_merge_trees/assets/@glimmer/opcode-compiler.js:234:1)
    at encodeOp (/var/folders/jc/81dkjn9s2sg5cpt_66jd8l640000gn/T/broccoli-19053Mj6xWKP11waW/out-206-broccoli_merge_trees/assets/@glimmer/opcode-compiler.js:2521:1)
    at pushOp (/var/folders/jc/81dkjn9s2sg5cpt_66jd8l640000gn/T/broccoli-19053Mj6xWKP11waW/out-206-broccoli_merge_trees/assets/@glimmer/opcode-compiler.js:2445:1)
    ```

@nicolechung
Copy link
Contributor

Note ^^ I tried updating fastboot, thinking it was maybe an earlier version, but this didn't seem to change that error message.

@NullVoxPopuli
Copy link
Contributor Author

ember-repl8a6aa7086c6a5dfb-b99e0fc2d0433e37,

was a component named this emitted on the broccoli tmp dir?

@nicolechung
Copy link
Contributor

It looks like it...I will try to get a screenshot of the folder.

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