如何将使用Gulp的节点部署到heroku [英] How to deploy node that uses Gulp to heroku

查看:105
本文介绍了如何将使用Gulp的节点部署到heroku的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用gulp和gulp插件,比如gulp-minify-css,gulp-uglify等(我的应用程序被列为npm依赖项)。

另外我不提交npm_modules文件夹和公用文件夹,其中所有生成的文件都是。我无法弄清楚如何在部署和设置我的服务器(它已经在查找公共文件夹)之后构建我的应用程序(我有gulp build命令)。



它看起来我是一个坏主意,在上传前提交。也许有一些温和的决定......任何想法?

如何将使用grunt的节点应用程序部署到heroku

解决方案



  

>scripts:{
start:node app,
postinstall:gulp default
}

postinstall 脚本在构建包后运行。有关更多信息,请查看。唯一令人讨厌的是你所有的依赖关系必须在依赖关系下生存,而不是单独的devDependencies

我不需要使用buildpack或配置。这似乎是最简单的方法。



我写过关于我使用的过程这里


I'm using gulp and also gulp plugins like gulp-minify-css, gulp-uglify etc (that listed as npm dependencies for my application).

Also I don't commit npm_modules folder and public folder, where all generated files are. And I can't figure out how to build my app (I have gulp build command) after deploy and setup my server (it's already looking for public folder).

It seems me a bad idea to commit before upload. Maybe there are some gentle decisions... Any thoughts?

Forked from: How to deploy node app that uses grunt to heroku

解决方案

I was able to get this to work by adding this into my "package.json" file:

"scripts": {
  "start": "node app",
  "postinstall": "gulp default"
}

The postinstall script is run after the build pack. Check this for more information. The only annoying thing is that all of your dependencies have to live under "dependencies" instead of having separate "devDependencies"

I didn't need to do anything else with buildpacks or configuration. This seems like the simplest way to do it.

I wrote about the process I used here

这篇关于如何将使用Gulp的节点部署到heroku的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆