[英]Not precompile on certain assets - Rails
I have a RoR project in which i have several assets that i don't want them to be precompiled in production mode. 我有一个RoR项目,其中我有几个资产,我不希望它们在生产模式下预编译。 These assets are compound by JS/CSS files and currently they are placed under app/assets/javascript/ism/.
这些资产由JS / CSS文件组成,目前它们位于app / assets / javascript / ism /下。
Actually, it's the whole ism folder which i don't want to compile. 实际上,它是我不想编译的整个ism文件夹。 Though in development mode it's useful and comfortable to keep those files there to work with them, in production mode they shouldn't be there.
虽然在开发模式下保持那些文件与它们一起使用是有用和舒适的,但在生产模式下它们不应该存在。 In production mode those files are all compiled (externally) in a separate file which is served by S3 ant not from RoR/Nginx.
在生产模式下,这些文件都是在一个单独的文件中编译(外部),该文件由S3 ant而不是RoR / Nginx提供。 The externally compiled file is even linked manually, not by RoR.
外部编译的文件甚至是手动链接,而不是RoR。
<script type="text/javascript" src="http://s3.blabla.com/file_compiled.js"></script>
So, what should it be the best way? 那么,它应该是最好的方式呢?
It's less than perfect, however you can prevent these files from being compiled by moving the ism directory out of the asset pipeline and serving them statically. 它并不完美,但是您可以通过将ism目录移出资产管道并静态地提供它们来阻止编译这些文件。 Eg moving
/app/assets/javascript/ism/
to /public/ism/
. 例如,移动
/app/assets/javascript/ism/
到/public/ism/
。
If you don't want these files on production at all, you could simply add public/ism/*
to your .gitignore
file (assuming you're using git). 如果你根本不想要生产这些文件,你可以简单地将
public/ism/*
添加到你的.gitignore
文件中(假设你正在使用git)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.