收到此错误,我错过了什么?
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
我正在使用Visual Studio 2010和新的网站发布对话框.我有一个Web应用程序网站.在发布时,理论上它应该将所有代码编译成单个程序集.然而,在这两个Debug和Release,发布目录后总是包含的页面和用户控件的源代码(即使未转换的web.config文件中Web.Debug.config和Web.Release.Config).这非常令人困惑.
但是使用package/publish web项目配置和Generate Deploy package上下文菜单项,Package\PackageTmp目录是干净的.
我知道Heroku正在运行rake资产:预编译任务:
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
-----> Rails plugin injection
Injecting rails_log_stdout
Injecting rails3_serve_static_assets
-----> Discovering process types
Procfile declares types -> (none)
Default types for Ruby/Rails -> console, rake, web, worker
-----> Compiled slug size is 17.7MB
-----> Launching... done
Run Code Online (Sandbox Code Playgroud)
我告诉它在production.rb中预编译图像
# from: http://stackoverflow.com/questions/8052865/rails-3-1-asset-pipeline-why-my-images-do-not-precompile-for-production
config.assets.precompile += %w[*.png *.jpg *.jpeg *.gif]
Run Code Online (Sandbox Code Playgroud)
那么为什么我仍然会得到这500个错误?
2012-05-29T02:57:15+00:00 app[web.1]: Started GET "/signin" for 46.114.68.16 at 2012-05-29 02:57:15 +0000
2012-05-29T02:57:15+00:00 app[web.1]: Processing by SessionsController#new …Run Code Online (Sandbox Code Playgroud) 我想使用预编译的underscore.js模板.我使用_.template().source并保存结果文件.但我不明白,如何使用这个模板.预编译模板是字符串,我无法将其强制转换为函数.我尝试使用eval,但它总是返回解析错误.
例如:
<div>
<% for(var i = 0; i < 5; i++){ %>
<div><%=i%></div>
<% } %>
</div>
Run Code Online (Sandbox Code Playgroud)
标准使用:
_.template(tpl).({});
Run Code Online (Sandbox Code Playgroud)
结果:
<div>
<div>0</div>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</div>
Run Code Online (Sandbox Code Playgroud)
预编译:
_.template(tpl).source
Run Code Online (Sandbox Code Playgroud)
预编译模板:
"function(obj){
var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};
with(obj||{}){
__p+='<div>\n\t';
for(var i = 0; i < 5; i++){
__p+='\n\t\t<div>'+
((__t=(i))==null?'':__t)+
'</div>\n\t';
}
__p+='\n</div>\n';
}
return __p;
}"
Run Code Online (Sandbox Code Playgroud)
运行预编译模板:
var a = eval(tplc);
a({});
Run Code Online (Sandbox Code Playgroud)
错误:
Error
line: 1
message: "Parse error"
sourceId: 139746789246216
__proto__: SyntaxError
Run Code Online (Sandbox Code Playgroud) template-engine precompile underscore.js underscore.js-templating
我想将我的.drl文件预编译为.class文件,这样就不必在运行时编译它们.该文档使听起来像kie-maven-plugin这样做,但它不会为我生成任何东西.它编译规则文件但不输出任何内容.有什么建议?
我正在使用mvn package命令,我的pom.xml文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.kie</groupId>
<artifactId>kie-parent-with-dependencies</artifactId>
<version>6.0.1.Final</version>
<!-- relativePath causes out-of-date problems on hudson slaves -->
<!--<relativePath>../droolsjbpm-build-bootstrap/pom.xml</relativePath>-->
</parent>
<packaging>kjar</packaging>
<artifactId>default-kiesession</artifactId>
<name>Drools API examples - Default KieSession</name>
<dependencies>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.kie</groupId>
<artifactId>kie-maven-plugin</artifactId>
<version>6.0.1.Final</version>
<extensions>true</extensions>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<repositories>
<!-- Bootstrap repository to locate the parent pom when the parent pom has not been build locally. -->
<repository> …Run Code Online (Sandbox Code Playgroud) 我正在将我们的Rails(3.2.17)应用程序升级到sass,并且在资产预编译期间遇到"未定义变量"错误.我使用@import将我的代码片段包含在master.scss文件中.此设置在本地运行良好,但在预补偿时出错.解决错误的唯一方法是将@import片段分成片段,这些片段引用第一个片段中定义的mixins和变量.
例如:我@import'fonts'和'buttons'进入master.scss然后我必须@import'fonts'第二次进入'buttons',因为它使用'fonts'中定义的变量.这避免了预补偿错误,但它并不理想,因为现在有两个"字体"加载到应用程序中,而不是只有一个"字体"实例.
@importing所有的片段只有一次进入master.scss在我不预编译时在本地工作.必须有一个解决方案.有什么想法吗?
将我的 Ruby on Rails 应用程序移动到生产服务器(AWS EC2 Amazon Linux 2018.03)后,页面不会呈现,因为错误“资产‘application.css’不存在于资产管道中”(预编译文件存在于公共/中)资产): 生产.log
但是,当我刷新应用程序时(有时不止一次),可以在缓存中找到该文件,并且页面可以正确呈现。看起来服务器不会等待文件预编译或类似的事情。它不仅发生在首页输入时,而且发生在每次视图变化时。
我遵循帖子中的提示: application.css not in asset pipeline,但这没有帮助。
我的堆栈:
我将非常感谢任何提示。
我正在努力避免编译错误在我们开发过程中阻止整个ASP站点.也就是说,我希望每个页面在首次运行时编译而不是整个站点,以便编译错误不会全局显示.当一个开发者在使用systnax bleherror保存后开始吃午饭时,这可能会令人讨厌.
我已经尝试将此添加到你的web配置(从默认的"始终"更改):
<pages compilationMode="Auto" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
Run Code Online (Sandbox Code Playgroud)
这没有达到预期的效果.我可以在webconfig中更改或使用IIS禁用预编译?
@static expr是一种只运行expr一次的方法; 对于某种感觉.
但它有什么意义呢?
是吗:
最常见的用途是用于OS检查:例如
ccall((@static Sys.iswindows() ? :_fopen : :fopen), ...)
我想知道我是否可以使用它来生成基于环境变量的不同代码:特别是JULIA_NUM_THREADS.这个环境变量可以在julia的运行之间改变,但如果它在会话期间发生变化,则不会对它做出任何反应.