从Visual Studio 2008创建网站时,您会看到一个包含一些选项的对话框.其中之一是"使用固定命名和单页组装".
我们没有启用,但这个选项的专业人士和内容是什么?性能或其他方面是否存在差异?我们应该或不应该使用这个?
如果没有这个选项,我们会在发布后在bin文件夹中获取774个文件,当我们检查它时,我们会得到1320个文件,因为每个ascx都有自己的dll.
如果我们检查一下,那么"固定名称"是否只在我的计算机上修复了?或者当同事发布网站时是否相同?
我正在收到页面"我们很抱歉,但是当我尝试加载我的rails应用程序时出现了问题.当我运行时
tail -f log/production.log
Run Code Online (Sandbox Code Playgroud)
我明白了
ActionView::Template::Error (rails.png isn't precompiled)
Run Code Online (Sandbox Code Playgroud)
我跑了
RAILS_ENV=production rake assets:precompile
Run Code Online (Sandbox Code Playgroud)
从当前目录.
我们的RoR应用程序使用了很多需要预编译的资产.通常需要几分钟assets:precompile才能运行.
然而最近发生了一件非常奇怪的事情:简单rake assets:precompile永不结束(等了几个小时).
我找到了一个解决方法:
rake assets:precompile --trace
Run Code Online (Sandbox Code Playgroud)
然而,无论如何修复它会很棒.关于某个原因的任何想法?
我正在尝试为PlayFramework 2.1编写一个SBT插件,它可以预编译位于app/assets/templates中的把手模板.我当然会在完成后分享这个插件.我发现这个HOWTO http://eng.netwallet.com/2012/04/25/emberhandlebars-template-precompilation-with-play/这是一个有点过时,但它是适应它玩没问题!2.1.
然后我尝试编译一个简单的模板文件,但SBT失败了以下内容:
ember: processing template test
[error] /.../templates/test.handlebars: Compilation error[unexpected exception during Ember compilation (file=/.../templates/test.handlebars, options=List(), ember=ember-1.0.0-pre.4.js): org.mozilla.javascript.EvaluatorException: missing name after . operator (ember-1.0.0-pre.4.js#3309)]
[error] (MyProject/*:play-copy-assets) @6dap83075: Compilation error in /.../templates/test.handlebars:null
[error] (MyProject/compile:resources) @6dap83075: Compilation error in /.../templates/test.handlebars:null
Run Code Online (Sandbox Code Playgroud)
第3309行的ember-1.0.0-pre.4.js有一个volatile关键字,显然是在Rhino中保留的.
我远非犀牛专家,这就是为什么我想知道是否有人知道如何解决这个问题?我现在不是在寻找5*解决方案.任何解决方案(即使是使用自定义ember.js的快速和肮脏的黑客)都有合理的机会为大多数简单的把手模板工作都可以工作,我们担心一旦功能出现并且SBT插件出来就抛光它.
提前致谢!
在我的Rails 4应用程序中,我有一个users.js.coffee文件app/assets/javascripts.它编译并在开发中正常工作.但是,当我部署到heroku时,它无法正常工作.据Railsguides说:
匹配器(以及预编译数组的其他成员;请参见下文)应用于最终编译的文件名.这意味着排除了编译为JS/CSS的任何内容,以及原始JS/CSS文件; 例如,.coffee和.scss文件在编译到JS/CSS时不会自动包含.
所以我在我的网站上添加了以下内容 config/environments/production.rb
config.assets.precompile += %w ( users.js.coffee )
Run Code Online (Sandbox Code Playgroud)
它仍然没有强制文件被预编译.你知道我怎么可能强迫Rails预编译它(我RAILS_ENV=production bundle exec rake assets:precompile用来预编译)?
非常感谢.
ruby-on-rails precompile coffeescript asset-pipeline ruby-on-rails-4
通过Visual Studio发布到Azure时,可以选择预编译页面。有很多选项可以解释它的功能,但是却没有权衡取舍。
Microsoft网站上有一些信息,但是在上述几点上,他们并没有真正涉足其中。
https://msdn.microsoft.com/zh-CN/library/hh475319(v=vs.110).aspx
这与Perl 6文档仓库中的此问题有关
实际运行BEGIN块
的阶段并不太清楚.文档说"编译时间",但Perl是预编译的,因此实际上可能是预编译时间.事实上,让我们使用这段代码
unit module Beginner;
BEGIN {
say "This is where all started";
}
Run Code Online (Sandbox Code Playgroud)
从这里
require Beginner;
say "Begun";
Run Code Online (Sandbox Code Playgroud)
在一个新目录(rm -rf .precomp运行).它输出:
This is where all started
Begun
Run Code Online (Sandbox Code Playgroud)
到目前为止,
.precomp已经创建了保存缓存的目录.
所以让我们从这里使用它:
use Beginner;
say "Already started";
Run Code Online (Sandbox Code Playgroud)
它显然只是回归Already started.(如果我们运行第一个程序也会发生同样的情况)这可能是一个问题,因为用户可能事先不知道是否可能发生预编译,这反过来意味着它不确定何时发生"编译时间".无论如何,问题是:我们如何正确地制定这个来在文档中解释它?此外,是否应该BEGIN鼓励使用(因为计算的值将存储在预编译缓存中,从而有效地从运行时中消除)或不鼓励?这有什么好的用例吗?
我正在尝试使用这个turtorial将我的rails应用程序部署到heroku:
https://devcenter.heroku.com/articles/getting-started-with-rails4
所以,我使用rails 4.1.1和ruby 2.1.1
我的Gemfile gem 'rails_12factor', group: :production里面有.
我的application.rb:
require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require(*Rails.groups)
module Charticus
class Application Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for …Run Code Online (Sandbox Code Playgroud) 我正在使用imgkit我的网页快照.我跑:
RAILS_ENV=production bundle exec rake assets:precompile 预编译我的资产.
app/assets目录的所有文件都编译为public/assets
application.css编译为application-7a23a105125768e41d9d24aee4553615.css.
我的控制器代码是:
kit = IMGKit.new(render_to_string(:partial => 'form', :height => 200, :transparent => true, :quality => 10, :layout => false,:locals => {:project => @project}))
# t = kit.to_img(:png)
kit.stylesheets << "#{Rails.root.to_s}/public/assets/application.css"
#file = kit.to_file(Rails.root + "public/pngs/" + "screenshot.png")
file = kit.to_file(Rails.root + "public/assets/" + "screenshot.png")
#send_file("#{Rails.root.to_s}/public/pngs/screenshot.png", :filename => "screenshot.png", :type => "image/png",:disposition => 'attachment',:streaming=> 'true')
Run Code Online (Sandbox Code Playgroud)
我不知道怎么解决/public/assets/application.css没找到错误...
没有这样的文件或目录 - public/assets/application.css
我正在使用https://github.com/csquared/IMGKit/issues/36获取css并在我的快照中工作
编辑
def …Run Code Online (Sandbox Code Playgroud) 我有一些问题,Sprockets在rake资产期间找不到文件:precompile.我之前没有遇到过这个问题,但是当我添加了一个生成的迁移(本地构建)时,Heroku无法构建我的应用程序,我不知道为什么,因为它在本地构建(没有我运行额外的rake资产:预编译).
错误信息是这样的:
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
Sprockets::FileNotFound: could not find file: /tmp/build_dd4a799769e6963b7b292df72db58fd8/username-appname-uniqueid/app/assets/stylesheets/application.scss
Run Code Online (Sandbox Code Playgroud)
有什么帮助吗?感谢您的时间!
PS.作为旁注 - 当我运行"rake assets:precompile"然后推送到Heroku时,应用程序会构建.然而,一个css类"fa-bars"的项目搞砸了......为什么会这样?
谢谢!