How does Ionic's default gulpfile relate to its cli tool?

穿精又带淫゛_ 提交于 2019-12-11 03:26:57

问题


Currently, I am running the app emulation using the Chrome browser with ionic serve. I also see that there is a gulpfile.js associated with the framework. What is the relationship between ionic and and gulp?


回答1:


Have a look at: https://github.com/driftyco/ionic-cli#advanced-serve-options (see "Gulp Integrations").

You can add a gulpStartupTasks property in the ionic.project file located in your project root.

They example the above linked documentation gives is:

{
  "name": "SmoothRiders",
   "gulpStartupTasks": [
    "watch"
  ]
}

In this case, the watch gulp task is executed when you run $ ionic serve.

If you run $ ionic setup sass, it will add the configuration to your ionic.project. Once you understand that, you're good to go so long as you understand gulp.




回答2:


Gulp is a task manager and let you perform several actions to automate your build.

I personnaly perform several actions PRE-BUILD to prepare my project before starting a proper ionic build that triggers hooks & everything normal.

My pre-build actions are mainly to customize my config.xml

Therefore, you can build a ionic project WITHOUT using any gulp commands. And you can use to help you build several steps of your project

Here is an exemple of someone work with gulp to help him "boost" his build process : http://www.thomasmaximini.com/2015/02/10/speeding-up-ionic-app-development-with-gulp.html Tasks that he performs are : SASS Compil & concatenation of severals But he also simplifies some of ionic cli commands.



来源:https://stackoverflow.com/questions/30628591/how-does-ionics-default-gulpfile-relate-to-its-cli-tool

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!