LearnNewsExamplesServices
Frontmatter
id7152
titleShowcase Nested Templates and Component Usage
stateClosed
labels
enhancement
assigneestobiu
createdAtAug 1, 2025, 2:23 PM
updatedAtAug 1, 2025, 2:24 PM
githubUrlhttps://github.com/neomjs/neo/issues/7152
authortobiu
commentsCount0
parentIssue7130
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtAug 1, 2025, 2:24 PM

Showcase Nested Templates and Component Usage

Closed v10.3.0 enhancement
tobiu
tobiu commented on Aug 1, 2025, 2:23 PM

1. Summary

Created a new example application to demonstrate the capabilities of string-based templates, specifically focusing on nested templates and the inclusion of other Neo.mjs components directly within the template.

2. Rationale

A practical example is crucial for developers to understand how to leverage the new HTML template feature effectively. This example highlights advanced usage patterns like template nesting and component composition, which are common in real-world applications. It also serves as a confirmation that the build process (specifically buildScripts/buildESModules.mjs) correctly handles these complex scenarios, converting them into optimized JSON VDOM.

3. Scope & Implementation Plan

  1. Create Example Component: Develop a new functional component at examples/functional/nestedTemplateComponent/Component.mjs.
  2. Implement Nested Templates: Within the example component, define and use a separate html template literal that is then conditionally included within the main component's html template.
  3. Integrate Another Component: Demonstrate how to include another Neo.mjs component (e.g., Neo.button.Base) directly within the html template using template interpolation (<${Button} />).
  4. Verify Build Process: Confirm that the buildScripts/buildESModules.mjs script correctly processes this example, converting the nested templates and embedded components into the appropriate JSON VDOM structure during the build.

4. Definition of Done

  • A new example component examples/functional/nestedTemplateComponent/Component.mjs exists.
  • The example successfully demonstrates nested html templates.
  • The example successfully demonstrates the inclusion of another Neo.mjs component within an html template.
  • The build process correctly converts this complex template structure into optimized JSON VDOM, as verified by inspecting the dist/esm output.
tobiu assigned to @tobiu on Aug 1, 2025, 2:23 PM
tobiu added the enhancement label on Aug 1, 2025, 2:23 PM
tobiu added parent issue #7130 on Aug 1, 2025, 2:23 PM
tobiu referenced in commit 35494c5 - "Showcase Nested Templates and Component Usage #7152" on Aug 1, 2025, 2:24 PM
tobiu closed this issue on Aug 1, 2025, 2:24 PM