vue.js gulp打包_如何使用gulp自动执行vue js项目中的构建

vue.js gulp打包

We know there are so many tasks we do manually while building a Vue project or any front end applications. We can automate all the repetitive tasks with the help of gulp. With Gulp, we can automate and enhance your workflow.

我们知道在构建Vue项目或任何前端应用程序时,我们需要手动完成许多任务。 我们可以借助gulp使所有重复性任务自动化。 借助Gulp,我们可以自动化和增强您的工作流程。

In this post, we will see two example projects one is a basic javascript project to get familiar with gulp and another is a full-blown Vue.js project. In the Vue project, we can see how we can automate builds.

在本文中,我们将看到两个示例项目,一个是熟悉gulp的基本javascript项目,另一个是功能完善的Vue.js项目。 在Vue项目中,我们可以看到如何自动化构建。

  • What is Gulp

    什么是Gulp

  • Installing Gulp

    安装Gulp

  • Example Project With Basic Gulp

    具有基本Gulp的示例项目

  • Example Project With Vue

    Vue的示例项目

  • Summary

    概要

  • Conclusion

    结论

什么是Gulp(What is Gulp)

Gulp is a toolkit to automate and enhance your workflow and you can use gulp and the flexibility of Javascript to automate slow, repetitive workflows and compose them into efficient build pipelines. It is flexible, comparable, and efficient. For example, if you are building a typescript project you can use gulp to transpile into a Javascript before running your project or you can use some plugins to optimize images for your project or you can watch files and build the project automatically.

Gulp是用于自动化和增强工作流程的工具包,您可以使用gulp和Javascript的灵活性来自动化缓慢的重复工作流程,并将其组合为有效的构建管道。 它具有灵活性,可比性和高效性。 例如,如果您正在构建一个打字稿项目,则可以在运行项目之前使用gulp将其转换为Javascript,或者可以使用一些插件来优化项目的图像,或者可以观看文件并自动构建该项目。

You can automate a lot more tasks like above with gulp. There are a lot of plugins built by the community. These plugins do some tasks efficiently and you can use these as building blocks and chain them to get the desired result.

您可以使用gulp自动执行更多类似上述的任务。 社区构建了许多插件。 这些插件可以高效地完成某些任务,您可以将它们用作构建基块并链接它们以获得所需的结果。

安装Gulp (Installing Gulp)

We need a node installed on our machine as a prerequisite. If you don’t have node installed check this link to install it. Once installed, check the version with this command to make sure you have installed it correctly.

我们需要先在计算机上安装一个节点。 如果您尚未安装节点,请检查此链接以进行安装。 安装完成后,请使用此命令检查版本以确保已正确安装。

node --version
npm --version

Once you have a node on your machine install the gulp globally so that you can use the command gulp anywhere you want. Once installed, check the version.

在计算机上拥有节点后,请在全球范围内安装gulp,以便可以在任何需要的地方使用gulp命令。 安装后,检查版本。

npm install -g gulp-cli
gulp --version
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值