我正在尝试找到一种方法来扫描整个Linux系统,查找包含特定文本字符串的所有文件.只是为了澄清,我在文件中寻找文本,而不是文件名.
当我查找如何做到这一点时,我遇到了两次这个解决方案:
find / -type f -exec grep -H 'text-to-find-here' {} \;
Run Code Online (Sandbox Code Playgroud)
但是,它不起作用.它似乎显示系统中的每个文件.
这是否接近正确的方法呢?如果没有,我该怎么办?这种在文件中查找文本字符串的能力对于我正在做的一些编程项目非常有用.
Heroku上的Rails 4有一个奇怪的问题.编译图像时,它们会添加哈希值,但CSS中对这些文件的引用没有调整正确的名称.这就是我的意思.我有一个名为logo.png的文件.然而,当它出现在heroku上时,它被视为:
/assets/logo-200a00a193ed5e297bb09ddd96afb953.png
Run Code Online (Sandbox Code Playgroud)
然而,CSS仍然指出:
background-image:url("./logo.png");
Run Code Online (Sandbox Code Playgroud)
结果:图像不显示.有人碰到这个吗?怎么解决这个问题?
我在生产中遇到asset_path问题.Rails 3.1.1
#config/environments/development.rb
Scc::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching …Run Code Online (Sandbox Code Playgroud) 我的rails应用程序有问题(Rails 4.0.0.rc2,ruby 2.0.0p195).
行为很奇怪:我的localhost正确显示背景图片,Heroku没有.
在heroku日志中,我可以看到以下错误:
ActionController::RoutingError (No route matches [GET] "/assets/piano.jpg"):
Run Code Online (Sandbox Code Playgroud)
我通过在custom.css.scss中插入以下代码来创建背景图像:
.full {
background: image-url("piano.jpg") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
Run Code Online (Sandbox Code Playgroud)
我用以下代码触发了这个,我在静态页面上有这个代码:
<body class="full">
....
</body>
Run Code Online (Sandbox Code Playgroud)
我已经在生产中运行了宝石:
group :production do
gem 'pg'
gem 'rails_12factor'
end
Run Code Online (Sandbox Code Playgroud)
在production.rb中,我将以下设置设置为true:
config.serve_static_assets = true
Run Code Online (Sandbox Code Playgroud)
但是,图像未显示.你能帮我吗?
我有一个Rails应用程序,其中包含以下内容/app/assets/stylesheets/styles.css.erb:
...
#nestedbg {
background-position: left top;
background-image: url(<%= asset_path 'siteheader2.png' %>);
background-repeat: repeat-x;
background-attachment: fixed;
}
...
Run Code Online (Sandbox Code Playgroud)
当我运行rake assets:precompile然后运行时rails s -e production,一切都按预期工作.但是,当我删除预编译的资产并rails s在开发中运行时,CSS文件如上所示出现而不是被正确替换.
我试图把config.assets.compile = true在/config/environments/development.rb,但这并没有帮助.
有任何想法吗?谢谢.
ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.1 asset-pipeline