Ember Animation 演示项目教程
1. 项目的目录结构及介绍
ember-animation-demo/
├── app/
│ ├── components/
│ ├── controllers/
│ ├── helpers/
│ ├── models/
│ ├── routes/
│ ├── styles/
│ ├── templates/
│ └── index.html
├── config/
│ ├── environment.js
│ └── optional-features.json
├── public/
│ └── assets/
├── tests/
│ ├── acceptance/
│ ├── integration/
│ ├── unit/
│ └── test-helper.js
├── vendor/
├── .editorconfig
├── .ember-cli
├── .gitignore
├── .jshintrc
├── .travis.yml
├── bower.json
├── ember-cli-build.js
├── package.json
├── README.md
└── testem.js
目录结构介绍
app/
: 包含应用程序的主要代码,包括组件、控制器、助手、模型、路由、样式和模板。config/
: 包含应用程序的配置文件,如environment.js
和optional-features.json
。public/
: 包含公共资源,如图片和字体。tests/
: 包含应用程序的测试代码,包括接受性测试、集成测试和单元测试。vendor/
: 包含第三方库和插件。.editorconfig
,.ember-cli
,.gitignore
,.jshintrc
,.travis.yml
: 配置文件,用于编辑器、Ember CLI、Git、JSHint 和 Travis CI。bower.json
,ember-cli-build.js
,package.json
,README.md
,testem.js
: 项目依赖、构建配置、包管理、项目说明和测试配置文件。
2. 项目的启动文件介绍
app/index.html
这是应用程序的入口文件,包含了基本的 HTML 结构和 Ember 应用程序的初始化代码。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>EmberAnimationDemo</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
{{content-for "head"}}
<link rel="stylesheet" href="{{rootURL}}assets/vendor.css">
<link rel="stylesheet" href="{{rootURL}}assets/ember-animation-demo.css">
{{content-for "head-footer"}}
</head>
<body>
{{content-for "body"}}
<script src="{{rootURL}}assets/vendor.js"></script>
<script src="{{rootURL}}assets/ember-animation-demo.js"></script>
{{content-for "body-footer"}}
</body>
</html>
ember-cli-build.js
这是 Ember CLI 的构建配置文件,用于配置应用程序的构建过程。
'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function(defaults) {
let app = new EmberApp(defaults, {
// 配置选项
});
return app.toTree();
};
3. 项目的配置文件介绍
config/environment.js
这是应用程序的环境配置文件,用于配置不同环境下的设置,如开发、测试和生产环境。
'use strict';
module.exports = function(environment) {
let ENV = {
modulePrefix: 'ember-animation-demo',
environment,
rootURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// 特性配置
},
EXTEND_PROTOTYPES: {
// 原型扩展配置
}
},
APP: {
// 应用程序配置
}
};
if (environment === 'development') {
// 开发环境配置
}
if (environment === 'test') {
// 测试环境配置
}
if (environment === 'production') {
// 生产环境配置
}
return ENV;
};
config/optional-features.json
这是可选特性的配置文件,用于启用或禁用某些 Ember 特性。
{
"jquery-integration": false,
"template-only-glimmer-components": true
}
通过以上介绍,您可以更好地理解和使用 Ember Animation 演示项目。希望这篇教程对您有所帮助!