编译在AWS弹性魔豆在Node.js的项目较少文件和缩小JS文件 [英] Compile less files and minify js files in node.js project on AWS Elastic Beanstalk

查看:183
本文介绍了编译在AWS弹性魔豆在Node.js的项目较少文件和缩小JS文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的Eb命令行界面来部署一个Node.js的项目AWS弹性魔豆。我使用Git版本控制。于是我运行部署的命令是简单的'混帐aws.push。 本地方面,我使用的咕噜从更少的文件编辑CSS文件,并运行如下,并cmobine js文件。

I am using the Eb Command Line Interface to deploy a node.js project to AWS Elastic Beanstalk. I am using git for version control. So the command I run to deploy is simply 'git aws.push'. Locally, I am using grunt to compile css files from less files and also minify and cmobine js files.

我不希望包括* .min.css文件或* .min.js在我的git仓库的文件,但宁愿让他们在部署后重新编译在AWS上。 有没有办法做到这一点?也许有.ebextensions挂钩的东西?

I don't want to include the *.min.css files or *.min.js files in my git repository but would rather have them recompiled on AWS after deployment. Is there a way to do this? Maybe with a .ebextensions hook or something?

推荐答案

我不熟悉的呼噜声,但我猜你有什么要做的就是安装nodejs和咕噜弹性豆茎,然后运行你的呼噜声命令,一旦容器设置。

I am not familiar with grunt, but I guess what you would have to do is install nodejs and grunt on elastic beanstalk and then running your grunt commands once the container is set up.

在一个ebextensions挂钩,如 .ebextensions / grunt.config ,你可以做到以下几点:

In a ebextensions hook such as .ebextensions/grunt.config you could do the following :

commands:
  01-install-nodejs-npm:
    command: "yum install -y --enablerepo=epel nodejs npm"
  02-install-grunt:
    command: "npm install -g grunt-cli"

container_commands:
  01-compilecss-minifyjs:
    command: "grunt build mytask"
    leader_only: true

该命令将确保nodejs,NPM和繁重的安装。该container_commands是从内部版本库的主目录执行的,所以源文件的呼噜声构建应该可以从那里。

The commands would make sure nodejs, npm and grunt are installed. The container_commands are executed from within your repository's home directory, so the "source" files for your grunt build should be available from there.

再次 - 我不繁重的工作,并不能告诉你,这将实际工作,但我希望它能帮助反正

Again - I don't work with grunt and can't tell if this would actually work, but I hope it helps anyway.

这篇关于编译在AWS弹性魔豆在Node.js的项目较少文件和缩小JS文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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