From cfef799d6d0a5086716cf17ffc47778e7400027c Mon Sep 17 00:00:00 2001 From: Tom Dale Date: Sat, 2 Mar 2019 02:03:21 -0500 Subject: [PATCH 1/7] First draft --- ...update-on-module-unification-and-octane.md | 380 ++++++++++++++++++ 1 file changed, 380 insertions(+) create mode 100644 source/blog/2019-03-02-update-on-module-unification-and-octane.md diff --git a/source/blog/2019-03-02-update-on-module-unification-and-octane.md b/source/blog/2019-03-02-update-on-module-unification-and-octane.md new file mode 100644 index 0000000000..acc724f0ef --- /dev/null +++ b/source/blog/2019-03-02-update-on-module-unification-and-octane.md @@ -0,0 +1,380 @@ +--- +title: 'Update on Module Unification & Octane' +author: Tom Dale +tags: Recent Posts, 2019, Ember Octane +responsive: true +--- + +Ember's conventions for project layout and file naming are central to the +developer experience. It's crucial that we get both the technical and +ergonomic details right. I wanted to provide an update about Module +Unification and our plans for the file structure in Ember Octane. + +In short, we intend to make templates play nicely with JavaScript, so you can +use the `import` feature you already know and love. By having components and +helpers be modules you can import, we can simplify Module Unification so it's +easier to learn and use. + +Here's an example of what I think template imports could look like: + +```js +// src/ui/components/blog-post.gbs + +import Component from '@glimmer/component'; +import UserProfile from './user-profile'; +import UserIcon from './icons/user'; + +export class BlogPost extends Component { + blog = { title: 'Coming soon in Octane', authorId: '1234' } + + +} +``` + +Here, we've imported two components—`UserProfile` and `UserIcon`—like we +would any other JavaScript module. We've also defined the component's +template in JavaScript, placing it in in a template tag within the class +body. + +For templates that aren't associated with a component (such as route +templates), we could allow template tags to be exported from JavaScript as +well: + +```js +// src/ui/routes/application.gbs + +import NavBar from '../components/NavBar'; + +export default ; +``` + +While the framework core team has reached consensus that template imports are +the path forward, please note that the syntax shown in the examples above is +hypothetical. While I'm personally a fan of the `