Skip to content

Instantly share code, notes, and snippets.

@gossi
Last active July 16, 2021 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gossi/5d7d57d05c1f135eb3a49437c180b79f to your computer and use it in GitHub Desktop.
Save gossi/5d7d57d05c1f135eb3a49437c180b79f to your computer and use it in GitHub Desktop.
Biophilic Glimmer Component Format

Idea for Ember Component Format/Syntax

The basis is, turn working and existing html into a glimmer component.

The html might look like this:

<!-- woohoo.html -->
<script>

const sayHello = () => {
  console.log('hello');
}

document.getElementById('woohoo').addEventListener('click', sayHello);
</script>

<style>
button {
  border: 1px solid blue;
  color: blue;
  background: white;
}
</style>

<button id="woohoo">Woohoo</button>

It has three elements to it:

  • markup
  • styling
  • behavior

Changing the file name from woohoo.html to woohoo.gc would make it continue to work !!!! (that's the whole point of this design)

Now let's give it glimmer/ember syntax specials:

{{! woohoo.gc }}

<script>
import { on } from 'whereever/glimmer/has/it';

const sayHello = () => {
  console.log('hello');
}
</script>

<style>
button {
  border: 1px solid blue;
  color: blue;
  background: white;
}
</style>

<button {{on "click" sayHello}}>Woohoo</button>

That's it =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment