meteor-blaze
Use when building or debugging Meteor 3 Blaze interfaces: meteor create --blaze, Spacebars, helpers/events, lifecycle, Tracker, ReactiveVar/ReactiveDict, subscriptions, Promise helpers, #let states, Template.dynamic, Blaze.render, and blaze-hot HMR. Triggers on stale async results, lost reactivity after await, data-context lookup surprises, duplicate DOM integrations, Rspack full reloads, raw HTML in triple braces, jQuery not found, Expected template or null, Template.instance() is null after await, missing event.dataTransfer, Reactive HTML attributes, BLOCKOPEN, TRIPLE template tag, Expected "li" end tag, or Template can't be named. Use this skill when asked about reusable Blaze components, the Blaze PWA scaffold, package/backend selection, Rspack entry imports, or template tests. For Meteor 2 to 3 upgrades, use migrate-to-meteor-3; for unexplained cross-layer failures, meteor-debugging.
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 11
- Forks
- 3
01 前言 Front Matter
- name
- meteor-blaze
- license
- MIT
- metadata
- { "area": "data", "kind": "knowledge", "author": "meteor", "bundle": [ "blaze" ], "meteor": ">=3.0", "tagline": "Build and debug Meteor 3 Blaze interfaces (Spacebars, Tracker state, async helpers, lifecycle, bundler-specific HMR, and components).", "docs_synced_at": "2026-11-13" }
- description
- Use when building or debugging Meteor 3 Blaze interfaces: meteor create --blaze, Spacebars, helpers/events, lifecycle, Tracker, ReactiveVar/ReactiveDict, subscriptions, Promise helpers, #let states, Template.dynamic, Blaze.render, and blaze-hot HMR. Triggers on stale async results, lost reactivity after await, data-context lookup surprises, duplicate DOM integrations, Rspack full reloads, raw HTML in triple braces, jQuery not found, Expected template or null, Template.instance() is null after await, missing event.dataTransfer, Reactive HTML attributes, BLOCKOPEN, TRIPLE template tag, Expected "li" end tag, or Template can't be named. Use this skill when asked about reusable Blaze components, the Blaze PWA scaffold, package/backend selection, Rspack entry imports, or template tests. For Meteor 2 to 3 upgrades, use migrate-to-meteor-3; for unexplained cross-layer failures, meteor-debugging.
02 资源文件 7
- 参考文档references/build-hmr-and-testing.md6.9 KB
- 参考文档references/eval-cases.md15.5 KB
- 参考文档references/jquery-backends.md3.7 KB
- 参考文档references/lifecycle-and-components.md6.5 KB
- 参考文档references/pwa-scaffold.md3.0 KB
- 参考文档references/spacebars-and-async.md7.9 KB
- 参考文档references/template-diagnostics.md4.6 KB
03 SKILL.md 正文
Blaze interfaces for Meteor 3
Blaze compiles Spacebars templates into JavaScript and updates small View
regions when their reactive dependencies invalidate. Keep state, subscriptions,
DOM effects, and async work owned by a template instance. Use public
Template, Blaze, Spacebars, and Tracker APIs in application code.
Decision flow
- For a new app, run
meteor create --blaze <name>. Inspect the generatedpackage.json,.meteor/packages, client entry, andrspack.config.jsbefore changing packages or build settings. - Import each template's
.htmlfrom the JavaScript module that registers its helpers, events, and lifecycle hooks. Import that module from the client entry graph. - Keep synchronous Minimongo reads in ordinary helpers. If a helper returns a Promise, render explicit pending, rejected, and resolved states.
- Put
ReactiveVar,ReactiveDict,this.autorun, andthis.subscribeon the template instance. Put DOM initialization inonRenderedand undo external effects inonDestroyed. - Pass named data and callbacks into reusable child templates. Keep publication and mutation authority on the server.
- Identify the bundler before diagnosing refresh behavior.
blaze-hotcan replace templates in the Meteor-bundler graph; Rspack currently performs a full live reload for Blaze. Route general build, migration, database, or test-runner work to the owning skill.
Current scaffold
meteor create --blaze my-app
cd my-app
meteor
Meteor 3.4+ creates Blaze apps with Rspack by default. Earlier Meteor 3
releases may use the Meteor bundler. The current scaffold declares explicit
client and server meteor.mainModule entries, imports .html from the client
entry, enables the modern build stack, and includes blaze-html-templates,
jquery, tracker, reactive-var, hot-module-replacement, blaze-hot, and
rspack, plus npm jquery.
Treat the generated files for the selected Meteor release as the baseline.
Those packages do not enable Blaze HMR in the Rspack graph. Blaze edits there
trigger a fast full page reload and reset page-local state. blaze-hot
replacement behavior applies when the Meteor bundler owns the module.
Inspect .meteor/versions before selecting runtime features. Blaze 3.0.3
requires jQuery; native DOM support starts at blaze@3.1.0-alpha.0
(prerelease). Read backend selection before
removing either jQuery dependency; upgrading Meteor alone does not select it.
Meteor 3.6's meteor create --pwa <name> provides a Blaze/Rspack
installable web app with a dependency-free service worker. It does not supply
offline Meteor data or native binaries. Read
PWA boundaries before changing caching or scope.
Component scaffold
<template name="taskList">
<label>
<input type="checkbox" class="js-show-done">
Show completed
</label>
{{#if Template.subscriptionsReady}}
{{#each task in tasks}}
{{> taskRow task=task}}
{{else}}
<p>No tasks.</p>
{{/each}}
{{else}}
<p>Loading...</p>
{{/if}}
</template>
import { Template } from "meteor/templating";
import { ReactiveVar } from "meteor/reactive-var";
import { Tasks } from "/imports/api/tasks";
import "./task-list.html";
Template.taskList.onCreated(function () {
this.showDone = new ReactiveVar(false);
this.autorun(() => {
this.subscribe("tasks.list", { showDone: this.showDone.get() });
});
});
Template.taskList.helpers({
tasks() {
const showDone = Template.instance().showDone.get();
return Tasks.find(showDone ? {} : { done: false }, {
sort: { createdAt: -1 },
});
},
});
Template.taskList.events({
"change .js-show-done"(event, instance) {
instance.showDone.set(event.currentTarget.checked);
},
});
this.autorun and this.subscribe stop when the instance is destroyed. A
cursor returned from a synchronous helper remains live through Minimongo.
Authorization and field projection still belong in the publication.
Async helpers
Use #let when loading, rejection, and empty results must be distinct:
{{#let profile=loadProfile}}
{{#if @pending "profile"}}<p>Loading...</p>{{/if}}
{{#if @rejected "profile"}}<p>Could not load profile.</p>{{/if}}
{{#if @resolved "profile"}}
{{> profileCard profile=profile}}
{{/if}}
{{/let}}
Persistent #let bindings can accept an older request's late result. Protect
overlapping requests with cancellation, a generation token, or a justified
queue. Direct Promise content in {{helper}} replaces its awaiting View on
reactive rerender; do not apply the binding rule universally. See
Promise ordering.
Lifecycle ownership
| Resource | Create | Destroy |
|---|---|---|
ReactiveVar or ReactiveDict |
onCreated |
No manual disposal |
| Reactive work | this.autorun |
Automatic with the instance |
| Subscription | this.subscribe |
Automatic with the instance |
| DOM widget | onRendered, often after Tracker.afterFlush |
Widget-specific teardown in onDestroyed |
| Window, document, timer, observer | Lifecycle callback | Explicit remove, clear, disconnect, or stop in onDestroyed |
| Programmatic Blaze View | Blaze.render or Blaze.renderWithData |
Blaze.remove(view) |
Read references/lifecycle-and-components.md for data-context rules,
callbacks, dynamic templates, DOM scoping, and cleanup patterns.
For compiler messages, helper/template collisions, post-await instance loss, or wrapped drag events, read template diagnostics.
Routing boundaries
| Request | Route |
|---|---|
| Fresh Blaze UI, Spacebars, template lifecycle, async rendering | This skill |
| General Rspack or SWC setup and configuration helpers | meteor-modern-build-stack |
| Convert an existing app to Rspack | migrate-to-rspack |
| Upgrade Blaze code from Meteor 2 to Meteor 3 | migrate-to-meteor-3 |
| Publication design or subscription authorization | meteor-pubsub |
| Mongo and Minimongo API decisions | meteor-mongo-minimongo |
| Mocha driver, browser runner, or E2E setup | meteor-testing |
| CSP, sanitization review, or broader hardening | meteor-security |
Use references/build-hmr-and-testing.md only for Blaze-specific entry
imports, HMR ownership, and programmatic template tests.
Anti-patterns
- Return async Minimongo values from every helper. Prefer synchronous client reads unless the flow is already async or shared with the server.
- Read reactive data only after
awaitwithout restoring the captured Tracker computation. - Treat
{{#each ...}}{{else}}as a loading indicator. Theelsebranch also covers rejection and a resolved empty sequence. - Pass implicit inherited contexts through reusable templates. Pass named data.
- Use global
$()ordocument.querySelectorfor component DOM. Scope lookup to the template instance. - Insert user-controlled content through triple braces or
Spacebars.SafeStringwithout trusted sanitization. - Remove DOM nodes created by
Blaze.renderwithout callingBlaze.remove. - Rely on private or removed UI-era APIs such as
UI.body,Template.__define__,Template.__body__,Spacebars.TemplateWith, orBlaze.InOuterTemplateScope.
Authoritative resources
- Meteor Blaze tutorial
- Blaze guide
- Spacebars API
- Templates API
- Blaze programmatic API
meteor/blazesource and testsreferences/spacebars-and-async.mdreferences/lifecycle-and-components.mdreferences/build-hmr-and-testing.mdreferences/eval-cases.md
04 同仓库更多 Skills
good-skill
Use when authoring a fixture skill for the validator. Triggers on validator unit tests. Use this skill when asserting the happy path through frontmatter validation.
meteor-foo
Use when testing the zip builder. Triggers on build-zips unit tests. Ask about archive layout.
_internal
Use when testing internal artifact exclusions. Triggers on ZIP builder tests.
internal-review
Use when testing that maintainer skills stay outside published ZIP artifacts.
oversize-body
Use when the body exceeds 8 KB. Triggers on validator size-limit testing.
one-trigger
Use when a description has only one trigger phrase and nothing else useful enough to push past the heuristic.