如果您启动一个新的 sproutcore 模板项目,则默认情况下仅加载 core_foundation 类。这意味着只有那些在您的主 sproutcore 构建文件中被定义为依赖项:
config :all, :required => "sproutcore/core_foundation", :theme => "sproutcore/empty_theme"
在大多数情况下,这是完全有道理的,因为在 sproutcore 1.5 中引入的模板视图系统不能很好地与模板结合使用。虽然,可以在“传统”sproutcore 视图中使用模板视图,例如SC.ContainerView(详见http://guides.sproutcore.com/using_handlebars.html#using-sc-templateview-inside-desktop-controls)你不能在模板视图中使用传统的sc桌面视图。
因此,当您开始一个新的模板项目时,桌面视图不会包含在构建文件中。但是,默认情况下也不包含其他一些有用的 sproutcore 模块,例如ajax 模块、数据存储或状态图模块。如果要使用这些模块,则必须调整构建文件并包含这些模块。它可能看起来像这样
config :all,
:required => [
"sproutcore/core_foundation",
"sproutcore/datastore",
"sproutcore/statechart",
"sproutcore/ajax" ]
:theme => "sproutcore/empty_theme"
包含特定模块或只是
config :all, :required => "sproutcore", theme => "sproutcore/empty_theme"
包括所有可用的sproutcore 模块。如果您想使用提供的组件启动传统的 sproutcore 项目,只需使用
# sc-init your-project
而不是
# sc-init your-project --template
这样,您将从一开始就得到正确的构建文件。当您从 sproutcore 开始时可能会感到困惑,但应该知道构建 sproutcore 模板应用程序与使用提供的桌面控件构建 sproutcore 应用程序是不同的。虽然,提供了路径来将现有的桌面类应用程序转换为模板应用程序,但不支持相反的方式(目前)。