Aptana / Eclipse 支持“js.erb”、“css.erb”文件
我正在 Eclipse 中开发 jRuby on Rails 应用程序。我最近安装了 Aptana 以更好地支持 Rails 文件。这为大多数文件类型(包括“html.erb”文件)提供了合理的突出显示和支持,但不支持其他 *.erb 文件。
这让我发疯,当我在 js.erb 文件中使用 ruby 标签时,他们一定是某个编辑器不会给我带来该死的语法错误。看起来就是这么基本的功能。
任何建议表示赞赏。我对几乎任何事情都持开放态度,我只是想要某种方法在 erb 文件中编写 javascript,而在每个 ruby 标签后不会出现一百万个语法错误。
尽管在运行应用程序时工作得很好,但这个示例在编辑器中给了我一个语法错误:
<%= render :partial => 'qunit/frame_wrapper_top' -%>
module("Carousel");
asyncTest('Slider Right Button', 1, function() {
setTimeout(function() {
var center_image = frame.find('.carouselContainer li img.current').attr('id');
var e = $q.Event("click");
$('.navButton_right').trigger( e );
setTimeout(function(){
start();
var current_center = frame.find('.carouselContainer li img.current').attr('id');
notEqual( current_center, center_image, "New item is in center");
}, 1000);
},1000);
});
I'm working on jRuby on Rails app in Eclipse. I recently install Aptana to better support the rails files. This provides reasonable highlighting and support for most file types includes "html.erb" files but not for other *.erb files.
It's driving me insane their must be some editor that doesn't give me a damn syntax error when I use ruby tags in js.erb files. It seems like such a basic function.
Any advice is appreciated. I am open to pretty much anything I just want some way to write javascript in erb files without a million syntax errors after every ruby tag.
This example give me a syntax error in the editor despite working perfectly fine when I run the app:
<%= render :partial => 'qunit/frame_wrapper_top' -%>
module("Carousel");
asyncTest('Slider Right Button', 1, function() {
setTimeout(function() {
var center_image = frame.find('.carouselContainer li img.current').attr('id');
var e = $q.Event("click");
$('.navButton_right').trigger( e );
setTimeout(function(){
start();
var current_center = frame.find('.carouselContainer li img.current').attr('id');
notEqual( current_center, center_image, "New item is in center");
}, 1000);
},1000);
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也在寻找可以处理 .js.erb 的编辑器或 IDE。 Aptana(3.0.9或3.2.0)似乎只识别ERB部分,JS不会突出显示。也许 Emacs+nXhtml 可以。
更新:nXhtml 确实可以为 emacs 完成这项工作。按照 README 中的说明将文件加载到 ~/.emacs 中,然后 Mx eruby-javascript-mumamo-mode !
I'm also looking for an editor or IDE that can handle .js.erb. Aptana (3.0.9 or 3.2.0) only seems to recognise the ERB part, the JS does not get highlighted. Maybe Emacs+nXhtml will work.
Update: nXhtml does do the job for emacs. Load the file in your ~/.emacs as described in the README, then M-x eruby-javascript-mumamo-mode !