链轮重复文件命名 [英] sprockets duplicate file naming

查看:62
本文介绍了链轮重复文件命名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的资产路径中有以下文件:

I have the following files, in my asset path:

javascripts/abc.js
templates/abc.js.mustache # this gets compiled to abc.js

自然,它们都将被请求为assets/abc.js.

naturally, they both would be requested as assets/abc.js.

有修复程序吗?如果不是,则需要修改Sprockets源代码的哪一部分?

Is there a fix? If not, what part of the Sprockets source would need to be modified?

我的思路是,如果引擎可以删除扩展名,则可以添加一个后缀.

My thinking is along the lines that if the engine can remove the extension, it can well enough add a suffix.

推荐答案

我遇到了同样的问题,但尚未找到令人满意的解决方案.我的网站有很多复杂的全栈插件(又名引擎),并且它们有很多CSS,JS和图像文件.不得不命名空间,例如每个插件中的"styles.css"有点烂.升级到Rails 3时,我假设文件解析器会将引擎/插件放在/styles中,但是不,它们全部组合到一个虚拟路径中.

I have the same problem, and have not yet found a satisfying solution. My sites have many complex full-stack plugins (aka engines), and they have lots of css, js, and image files. Having to namespace, eg "styles.css" in each plugin kinda sucks. When upgrading to Rails 3, I assumed the file resolver would put engines/plugins in /styles, but no, they all get combined into one virtual path.

我当前的临时解决方案是构建一个我运行的rake任务,检查重复的文件名.我在提交代码和部署之前运行它.骇客!如果有帮助,那么很好,甚至没有帮助,也许有人在那里有一个更优雅的解决方案...

My current temporary solution is to build a rake task that I run that checks for duplicate filenames. I run it before committing code and on deployment. Hackity! If that helps, great, if not, perhaps someone out there has a more elegant solution...

这篇关于链轮重复文件命名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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