导轨供应商文件夹angular2开发与生产 [英] rails vendor folder angular2 development and production

查看:134
本文介绍了导轨供应商文件夹angular2开发与生产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好十分了得codeRS,

Hello very amazing coders,

我目前使用NPM来管理angular2依赖。然后我手动从 node_modules 所需angular2的文件复制到我的rails 厂商文件夹中。铁轨将这些文件提供给我加载。不过,我读过该供应商的文件不应该在源头控制。好吧,很公平,我同意。但是,如果我的.gitignore这些文件,他们不会让它到的Heroku。随后我的<脚本>< / SCRIPT> 在标记应用程序/视图/布局/ application.html.erb 回404没有找到。

I'm currently using npm to manage angular2 dependencies. I then manually copy the required angular2 files from node_modules into my rails vendor folder. The rails will make those files available for me to load. However, I've read that vendor files should not be in source control. Ok, fair enough, I agree. However, if I .gitignore these files, they do not make it onto heroku. And subsequently my <script></script> tags in app/views/layouts/application.html.erb return 404's not found.

我要找的总体指导你如何做的家伙资产供应商的生产与发展?在我的情况下,angular2源文件宝石不存在,那么pretend这是不是一种选择。

I'm looking for overall guidance on how you guys do vendor assets in production vs. development? In my case, a gem for angular2 source files does not exist, so pretend that is not an option.

推荐答案

有对这个这么多的口味和其他一切就看你的项目。这里有一些:

There's so many flavors for this and as everything else it depends on your project. Here are some:

1,您可以使用CDN生产中的图书馆,按理说它是更好的版本,因为有一个很好的机会,人们访问你的网页将已经下载的jQuery或W / E从CDN在访问另一页,所以你他们不'T要独自尚未下载另一个副本为您的网页。如 https://www.maxcdn.com/ 或的 https://developers.google.com/speed/libraries/

1- You can use cdn versions of the libraries in production, which is supposedly better because there's a good chance that people visiting your page would have already downloaded jquery or w/e from a cdn while visiting another page so you they don't have to download yet another copy for your page alone. Like https://www.maxcdn.com/ or https://developers.google.com/speed/libraries/.

2 - 你可以有一个回购与它的code,来源和所有,未经供应商的文件,一个更回购连接到Heroku的,如果你想,你把你的项目,包括仅分配打造,供应商的文件。

2- You can have one repo with your code on it, sources and all, without the vendor files and one more repo connected to heroku where you push only the distributable build of your project including if you want, the vendor files.

3运行相同的NPM安装和你通常从生产服务器使用所有其他配置脚本,Heroku的应该让你这样做NP,或者至少有一个插件吧。

3- Run the same npm install and all other configuration scripts you normally use from your production server, Heroku should allow you to do this np, or at least have a plugin for it.

我希望这有助于。

这篇关于导轨供应商文件夹angular2开发与生产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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