我使用codekit编写less,然后自动转换为css.
我不希望rails将我较少的文件转换为css,我更喜欢codekit.
如果我通过预编译资产
rake assets:precompile
Run Code Online (Sandbox Code Playgroud)
我明白了
rake aborted!
cannot load such file -- less
Run Code Online (Sandbox Code Playgroud)
如何从预编译中排除特定文件夹/文件类型?(我所有较少的文件都在app/assets/stylesheets/less中,css(我想要预编译)在app/assets/stylesheets/css中
更新
删除application.less解决了这个问题,但我如何将其从处理中排除?
less precompile ruby-on-rails-3 asset-pipeline ruby-on-rails-3.2
预编译的查询由DB供应商(如oracle,sql server等)预先编译和缓存,以便它们可以更快地进行连续调用,如预处理语句.
在Hibernate命名查询据说是在Web服务器启动时预编译的.这是否意味着所有查询都在服务器启动时触发,以便它们可以由DB供应商预编译或预编译在hibernate上下文中具有不同的含义?
我希望这不是一个重复的问题; 我在SO上尝试了其他解决方案,没有任何效果
将我的应用程序推送到Heroku时,推送失败,因为application.css无法编译.
我的终端输出:
Running: rake assets:precompile
rake aborted!
Sass::SyntaxError: Invalid CSS after " */": expected selector, was "@font-face"
(in /tmp/build_17e92975-ae8d-446f-8678-110eeeccfb64/app/assets/stylesheets/adminsite/application.css)
(sass):1845
Run Code Online (Sandbox Code Playgroud)
尝试解决方案
我已经搜索并删除了在../stylesheets/adminsite/目录中@ font-face之前的每个"*/"实例.相同的问题和结果.
我试过设置:
config.assets.compile = true
Run Code Online (Sandbox Code Playgroud)
......同样的问题
编辑
这是我的application.css(不是应用程序级别1,而是adminsite目录中失败的那个)
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. …Run Code Online (Sandbox Code Playgroud) 编辑:其他人有什么建议吗?我完全难过了!!!
我有一个应用程序,其中所有资产编译得很好,但在第二个应用程序,当我运行时:
RAILS_ENV=production rake assets:precompile --trace
Run Code Online (Sandbox Code Playgroud)
我收到以下消息:未定义的方法`目录?' 为零:NilClass
请帮忙.当我查看public/assets目录时,我看到图像文件已经预编译但没有js或css文件.
以下是完整的终端输出:
=> RAILS_ENV=production rake assets:precompile --trace
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/Users/swamiatma/.rvm/rubies/ruby-1.9.2-p290/bin/ruby /Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
undefined method …Run Code Online (Sandbox Code Playgroud) 我有一个专有的应用程序,我想发给几个人进行测试,除了我们不想透露他们的来源.该应用程序是用C++ for Linux编写的.它链接到Fedora/Ubuntu repos上随时可用的包.
有没有办法将源处理为中间...然后分发它,并让用户进行最终编译,实际编译并将中间代码链接到其本机平台.
我试图看看是否有任何替代分发预编译的二进制文件.谢谢.
Sprockets::FileNotFound: couldn't find file 'jquery.ui.all'
Run Code Online (Sandbox Code Playgroud)
我尝试了迄今为止发现的所有建议.它们都不适合我.我无法继续运行开发中的程序,因此我不能再在线进行新的部署.
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.0'
gem 'bcrypt-ruby', '3.0.1'
gem 'faker', '>=1.1.2'
gem 'pg', '>=0.15.1'
gem 'uglifier', '>=2.1.1'
gem 'coffee-rails', '>=4.0.0'
gem 'jbuilder', '~> 1.2'
gem 'activerecord-import', '>=0.4.1'
gem 'rubyzip2'
gem 'date_validator'
gem 'psych', '~> 2.0.5'
gem 'json', '>=1.8.1'
gem 'turbolinks', '>=1.1.1'
gem 'sass-rails', '>=4.0.0'
gem 'bootstrap-sass', '>=3.0.0.0'
gem 'will_paginate', '>=3.0.4'
gem 'bootstrap-will_paginate','>=0.0.9'
gem 'bootstrap-sass-rails'
gem 'bootstrap-datepicker-rails'
gem 'jquery-ui-bootstrap-rails'
gem 'geocoder'
gem 'jquery', '>=0.0.1'
gem 'jquery-rails', '>=2.2.1'
gem 'jquery-datatables-rails', github: 'rweng/jquery-datatables-rails'
gem …Run Code Online (Sandbox Code Playgroud) 在阅读nginx源代码时,我发现这一行:
#define NGX_INT32_LEN sizeof("-2147483648") - 1
Run Code Online (Sandbox Code Playgroud)
为什么使用sizeof(" - 2147483648") - 1?
not sizeof(-2147483648) - 1
不是-2147483648 - 1
不是-2147483649或者?
有什么不同?
尝试在本地预编译资产时,我得到以下内容
RAILS_ENV=production bundle exec rake assets:precompile
rake aborted!
Sprockets::NotImplementedError: Custom asset_path helper is not implemented
Extend your environment context with a custom method.
environment.context_class.class_eval do
def asset_path(path, options = {})
end
end
/Users/cman/.rvm/gems/ruby-2.2.2@jbd-ruby2.2.2/gems/sprockets-3.6.0/lib/sprockets/context.rb:198:in `asset_path'
/Users/cman/.rvm/gems/ruby-2.2.2@jbd-ruby2.2.2/gems/sprockets-3.6.0/lib/sprockets/context.rb:218:in `font_path'
/Users/cman/.rvm/gems/ruby-2.2.2@jbd-ruby2.2.2/gems/font-awesome-rails-4.6.1.0/app/assets/stylesheets/font-awesome.css.erb:15:in `_evaluate_template'
Run Code Online (Sandbox Code Playgroud)
我不能为我的生活弄清楚为什么会这样 - 任何有关如何解决的建议将不胜感激!
更新
只有在我添加具有以下内容的初始化程序时,我才能进行预编译:
Rails.application.assets.context_class.class_eval do
def asset_path(path, options = {})
return ''
end
end
Run Code Online (Sandbox Code Playgroud)
但是,如果我这样做,当我推送到我的暂存环境时,Bootstrap中的glyphicons有一个空路径,因此不会渲染:
font-face{font-family:'Glyphicons Halflings';src:url("");src:url("") format("embedded-opentype"),url("") format("woff"),url("") format("truetype"),url("")
Run Code Online (Sandbox Code Playgroud)
更新2
如果我将初始化程序修改为如下所示,我在预编译bootstrap资产中获取了一个用于glypicons的路径,但它不是预编译的Glyphicon文件,而是非编译资产路径:
Rails.application.assets.context_class.class_eval do
def asset_path(path, options = {})
#return ''
"/assets/#{path}"
end
end
@font-face{font-family:'Glyphicons Halflings';src:url("/assets/bootstrap/glyphicons-halflings-regular.eot");src:url("/assets/bootstrap/glyphicons-halflings-regular.eot?#iefix") format("embedded-opentype"),url("/assets/bootstrap/glyphicons-halflings-regular.woff") format("woff"),url("/assets/bootstrap/glyphicons-halflings-regular.ttf") format("truetype"),url("/assets/bootstrap/glyphicons-halflings-regular.svg#glyphicons_halflingsregular")
Run Code Online (Sandbox Code Playgroud)
这是我的gemfile.lock,因为它与assets/sprockets …
收到此错误,我错过了什么?
Sprockets::Rails::Helper::AssetNotFound in Static#index:
The asset "my_logo.jpg" is not present in the asset pipeline.
ActionView::Template::Error (The asset "my_logo.jpg" is not present in the asset pipeline.):
1: <%= image_tag "my_logo.jpg" %>
Run Code Online (Sandbox Code Playgroud)
我创建了一个新的 Ruby on Rails 应用程序rails new my_app# Rails 6.0.3.2
允许它安装 gems、web packer 等。
添加config.assets.compile = falseconfig/environments/development.rb
添加包含此内容的静态控制器和索引文件
应用程序/控制器/static_controller.r b
Sprockets::Rails::Helper::AssetNotFound in Static#index:
The asset "my_logo.jpg" is not present in the asset pipeline.
ActionView::Template::Error (The asset "my_logo.jpg" is not present in the asset pipeline.):
1: <%= …Run Code Online (Sandbox Code Playgroud)ruby ruby-on-rails precompile asset-pipeline rails-sprockets
precompile ×10
assets ×2
compilation ×2
binary ×1
c ×1
c++ ×1
css ×1
distribute ×1
heroku ×1
hibernate ×1
java ×1
jpa ×1
less ×1
macros ×1
named-query ×1
node.js ×1
obfuscation ×1
rake ×1
ruby ×1
sprockets ×1