如何将聚合物(1.0)与Rails(4)一起使用? [英] How to use Polymer (1.0) with Rails (4)?

查看:52
本文介绍了如何将聚合物(1.0)与Rails(4)一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在,聚合物(1.0)是生产就绪"的,这是在Rails(4)上使用它的最好方法吗?

Now that Polymer (1.0) is "Production Ready" Which is the best way to use it on Rails (4) ?

我读了很多书,发现所有解决方案都已弃用,(例如,使用Gems:likepolymer-rails,emcee等)

I read a lot and I saw that all the solutions are deprecated, (For example using Gems like: likepolymer-rails, emcee , etc)

我迷失了为该项目创建良好的结构以及包括所有聚合物组件的方法,我也不知道Sprocket是否可以提供帮助.

I'm lost trying to create a good structure for the project, and the way to include all the polymer components, also I don't know if Sprocket could help or not.

推荐答案

更新 (2015年6月16日):已经发布了一个官方软件包polymer-rails发布.请参阅 polymer-elements-rails ,它是新的 official 存储库,其中包括paper-neon-elements.

UPDATE (16 June 2015): An official package has been released for polymer-rails. Please see polymer-elements-rails, which is the new and official repository which includes iron-, paper-, and neon-elements.

对于可能仍将它们设置为依赖项的任何人,我将暂时保留这些分叉,但是使用官方存储库将为您提供相同的功能和长期的支持,因此我敦促您

I will be keeping these forks up for the time being for anyone who may still have them already set as a dependency, but you will get identical functionality and prolonged support from using the official repository, so I urge you to switch if you haven't.

polymer-rails 项目已更新至1.0,但不幸的是,这些组件的宝石还没有.我已经开始并创建了适当的派生,以便在此期间有一些可行的选择.

The polymer-rails project has been updated to 1.0, but unfortunately, the gems for the components have not yet. I've gone ahead and created the appropriate forks so that there's some working option in the meantime.

  • https://github.com/vsimonian/polymer-iron-rails
  • https://github.com/vsimonian/polymer-paper-rails
  • https://github.com/vsimonian/polymer-neon-rails

您的gemfile应该具有:

Your gemfile should have:

gem 'polymer-rails'
gem 'polymer-iron-rails', :git => "git://github.com/vsimonian/polymer-iron-rails.git"
gem 'polymer-paper-rails', :git => "git://github.com/vsimonian/polymer-paper-rails.git"
gem 'polymer-neon-rails', :git => "git://github.com/vsimonian/polymer-neon-rails.git"

然后运行bundle.

app/assets/components/application.html.erb中,设置依赖项:

//= require polymer/polymer
//= require iron-ajax/iron-ajax
//= require iron-input/iron-input
.....

app/assets/javascripts/application.js应包含:

//= require webcomponentsjs/webcomponents-lite

您的.bowerrc应该设置了第三方组件目录:

Your .bowerrc should have the 3rd-party component directory set:

{
  "directory": "vendor/assets/components"
}

这篇关于如何将聚合物(1.0)与Rails(4)一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆