当 Sprockets 合并 javascript 文件时,如何包含原始文件名?
我们正在使用最新版本的Sprockets on Rails 3.0.10。一切都运行良好,总体而言,这是一次顺利且无问题的部署,但我们确实有一个小烦恼,我希望有一个简单的解决方案。
当 javascript 文件组合在一起时,当我在浏览器中进行调试时,没有简单直接的方法来确定特定的 javascript 部分来自哪个文件。
我们也使用 SASS,我喜欢它包含的注释,指示可以在我的原始 CSS 文件中找到该规则的位置。
我可以在链轮上设置选项或标志来允许类似的行为吗? (例如,在每个包含文件的开头自动生成注释,指示其原始路径)
We are using the latest version of Sprockets on Rails 3.0.10. Everything is working great, and overall it's been a smooth and problem free deployment, but we do have one minor annoyance that I hope there is a simple solution for.
When javascript files are combined together, there's no simple, straightforward way to determine what file a particular bit of javascript came from when I'm debugging in a browser.
We use SASS as well and I love the way that it includes comments indicating where the rule can be found in my original CSS file.
Are there options or flags I can set on Sprockets to allow similar behaviour? (say, an auto-generate comment at the beginning of each included file indicating it's original path)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您无法解决问题,您可以尝试使用 Rails 3.1 :资源管道未在开发环境中编译,因此您可以立即看到问题出在哪个 javascript 文件中。
In case you can't solve your problem, you could try using Rails 3.1 : the asset pipeline isn't compiled in the development environment, so you can immediately see in which javascript file your problem is.