美文网首页
Ember.js初体验

Ember.js初体验

作者: PaytonDeng | 来源:发表于2016-11-07 00:53 被阅读0次

    创建一个新的App

    要使用Ember CLI创建新项目,请使用命令:ember new projectName 其中projectName就是你想要创建的项目名称,执行完这个命令后,会在当前目录创建一个名为projectName的文件夹。

    先简单介绍一个Ember CLI,Ember CLI,提供了一个标准的项目结构,一组开发工具和一个addon系统。这允许Ember开发人员专注于构建应用程序,而不是构建使它们运行的支持结构。 在命令行界面,执行ember --help显示Ember CLI提供的所有命令。 有关特定命令的更多信息,可以键入ember help <command-name>查看详细的信息。

    执行ember new projectName之后生成的目录projectName下的目录结构:

    |--app
    |--bower_components
    |--config
    |--dist
    |--node_modules
    |--public
    |--tests
    |--tmp
    |--vendor
    bower.json
    ember-cli-build.js
    package.json
    README.md
    testem.js
    

    app是主要存放项目代码的目录,里面含有

    |--adapters
    |--components
    |--controllers
    |--helpers
    |--models
    |--routes
    |--styles
    |--templates
    index.html
    app.js
    router.js
    

    bower_components是存放bower.json依赖文件的
    config是存放与当前项目配置的,目录内有配置文件名为environment.js
    dist是项目打包默认存放的地方,如使用命令ember build,输出的文件的默认目录就是dist
    node_modulespackage.json依赖文件存放的地方
    public是开发时的网站根目录http://localhost:4200的根目录
    tests存放测试相关代码
    tmp存放缓存文件
    vendor存放没有发布到bower上的第三方库文件

    运行开发服务器

    控制台进入projectName目录,然后执行ember s,然后打开浏览器,在地址栏输入:http://localhost:4200

    重要的流程图

    常用的网站

    Ember.js官网
    Ember CLI官网

    相关文章

      网友评论

          本文标题:Ember.js初体验

          本文链接:https://www.haomeiwen.com/subject/hmjluttx.html