search

Home  >  Q&A  >  body text

angular.js - angular 2 应用如何进行打包?如何使用gulp打包?

angular 2强调模块化,从npm下载的包数量巨大,该如何使输出后的应用,只包含需要的模块?
以及如何使用gulp打包angular2应用?

给我你的怀抱给我你的怀抱2744 days ago557

reply all(4)I'll reply

  • 天蓬老师

    天蓬老师2017-05-15 17:07:22

    Thank you for the invitation. I haven’t started learning Angular2 yet, but I have been playing with typescript recently. I wrote a gulp+typescript+AngularJS1.x environment to play with. I am interested in studying together: https://github.com/hjzheng/ An...

    About Angular2, there are actually many seeds on Github, either based on webpack or gulp:
    https://github.com/search?q=a...

    In addition, there are some Angular2 scaffolding on yeoman
    http://yeoman.io/generators/

    reply
    0
  • 高洛峰

    高洛峰2017-05-15 17:07:22

    Recommend angular2-webpack-starter and angular2-universal-starter.

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-15 17:07:22

    Thank you for the invitation. I have never used angular2. I use react. You can try packaging it with webpack

    reply
    0
  • 大家讲道理

    大家讲道理2017-05-15 17:07:22

    Thanks for the invitation. I have never used angular2, so I don’t know what its special features are. I can only say generally,

    Gulp packaging is actually mainly divided into css, js, and html.

    We classify angular as js, so what js packaging actually does is to analyze the packaging entry file, parse the dependent js files, then merge the js files, add dependencies, compress, add md5 stamp, and output to the directory.

    According to your question, what you need to focus on is packaging entry files and parsing dependencies. You can use the angular-related gulp plug-in, or you can use webpack to parse, both of which can reach your directory.

    reply
    0
  • Cancelreply