我已经构建了一个 Ruby on rails 应用程序。我想在我的 ruby on rails 应用程序中使用 polymer 。凸轮有人建议一些好的资源来学习带有 rails 的 polymer 吗?
在 rails 上使用带有 ruby 的 polymer 是否有效?
如果有的话,还请建议比 polymer 更好的选择吗?
最佳答案
我正在使用凉亭,所以我希望您的系统上已经设置了凉亭。
(brew install node && npm install bower)
gem 'bower-rails'
gem 'emcee'
bundle install
rails g bower_rails:initialize
rails g emcee:install
asset 'angular'
asset 'angular-route'
asset 'angular-resource'
asset 'angular-mocks'
asset 'webcomponentsjs'
asset 'polymer', github: 'Polymer/polymer'
asset 'polymer-core-elements', github: 'Polymer/core-elements'
asset 'polymer-paper-elements', github: 'Polymer/paper-elements'
asset 'platform'
# Voice Synthesis and Recognition
asset 'voice-elements'
找出您需要的并删除其余的。
rake bower:install
要下载组件,但请注意文件将保存在 vendor/assets/bower_components 中,而不是 emcee 期望的 vendor/assets/components 中。所以你需要建立符号链接(symbolic link)。 rm -rf vendor/assets/components
ln -s vendor/assets/bower_components vendor/assets/components
# app/assets/components/application.html
*= require polymer/polymer
# app/assets/javascripts/application.js
//= require angular/angular
//= require angular-route/angular-route
//= require angular-resource/angular-resource
//= require webcomponentsjs/webcomponents
//= require platform/platform
(请注意,我只包括了我用于测试的所有内容。如前所述,删除不需要的内容)。
# config/application.rb
config.assets.paths << Rails.root.join("vendor","assets","bower_components")
这就是设置。跳上它并开始使用它。
= html_import_tag "application", "data-turbolinks-track" => true
# sample.html.haml
================
%paper-tabs{:selected => "0", :scrollable => ""}
%paper-tab Skills
%paper-tab Experiences
%paper-tab Education
引用
http://angular-rails.com/bootstrap.html
http://www.akitaonrails.com/2014/06/29/usando-polymer-com-rails#.VHcoW2SsV81
关于ruby-on-rails - 带 rails 的 Google polymer 4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26884022/