• Stars
    star
    286
  • Rank 144,690 (Top 3 %)
  • Language
    HTML
  • License
    MIT License
  • Created over 10 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Polymer and web components for Ruby on Rails

Polymer-Rails

Want to get started with web components? Want to bring them into your Rails app? Easily build your own and use web components that are built by community in your Ruby on Rails Application. Polymer-rails helps you to do this:

  1. Adds polymer library to assets of your rails project.

  2. Allows you to easily import web component with <%= html_import_tag "my-component" %> helper.

  3. Allows you to import and package web components into assets pipeline, exactly as you would Javascript or CSS

Prefer using SASS or CoffeeSript?

Polymer-rails works well with compiling assets, such as CoffeeScript and Sass. You can easily use external stylesheet or script tag references in your web component <link rel="stylesheet" href="application.css"> for stylesheets and <script src="application.js"> for javascripts. This assets will be automatically compiled and required into component html file.

  • Note that if you're using sass or coffee precompilation, assets are required to use '.css.sass' and '.js.coffee' extensions.*

Versions

Polymer 2.0 is out!

  • Use 0.2.x versions of polymer-rails to work with Polymer versions 0.5.x
  • Use 1.0.x versions of polymer-rails to work with Polymer versions 1.0.x
  • Use 2.0.x versions of polymer-rails to work with Polymer versions 2.0.x

1.0 release is not compatible with the 0.5 APIs. For guidance on migrating an existing 0.5 elements to the 1.0 APIs, see the Migration guide.

Installation

Add this line to your application's Gemfile:

gem 'polymer-rails'

And then execute:

$ bundle

Or install it yourself as:

$ gem install polymer-rails

Usage

Installation

$ rails g polymer:install
  • This generator adds //= require webcomponentsjs/webcomponents-loader into application.js manifest file
  • Creates app/assets/components and application.html manifest file where you can include all your components.
  • Creates vendor/assets/components directory for third-party web components.

After running rails g polymer:install, add <%= html_import_tag 'application'%> line into your layout, to import web components manifest to your app.

Creating a component

$ rails g polymer:component <component-name>

This generates new <component-name> component directory and .html, .css, .js files of the same name under app/assets/components folder.

Add your component to .html manifest file after requiring polymer:

//
//= require polymer/polymer
//= require component-name/component-name

And you can use your component in Rails application!

Polymer core/paper elements

Polymer team is working on set of core element which you can learn more about here http://www.polymer-project.org/docs/elements/core-elements.html. If you want to use them in your Rails application, checkout polymer-core-rails gem.

You may also be interested in Polymer paper elements, they are also available as polymer-paper-rails gem.

Example

See example Rails application here http://polymer-rails-example.herokuapp.com/

Source code can be found here https://github.com/alchapone/polymer-rails-example

Learn more

You can check out http://customelements.io/ or http://component.kitchen/ to see what components are already built by community.

Contributing

  1. Fork it ( http://github.com/alchapone/polymer-rails/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

More Repositories

1

hard-rock-coffeescript

CoffeeScript Book
CSS
112
star
2

polymer-paper-rails

The Paper elements are a set of UI elements that implement the material design system
HTML
54
star
3

polymer-elements-rails

Polymer elements for Rails
JavaScript
39
star
4

polymer-core-rails

Polymer core elements for Ruby on Rails project
HTML
32
star
5

gen-ai

✨ Generative AI toolset for Ruby ✨
Ruby
28
star
6

hugging-face

Ruby client for Hugging Face API
Ruby
27
star
7

css-class-name-generator

Collection of simple and human readable class names
HTML
19
star
8

polymer-rails-example

Example Ruby on Rails App with polymer-rails gem
Ruby
17
star
9

marionette.doc

Marionette.js 1.8.0 documentation
16
star
10

wfpc

Web Frameworks Performance Comparison
PHP
12
star
11

generator-simpleapp

Yeoman generator for simple website with sass, coffee, autoprefixer and livereload
JavaScript
10
star
12

devion

πŸ§‘β€πŸ’»One Command to Run All your Projects in Development
JavaScript
9
star
13

ai21

A Ruby client for AI21 Studio API
Ruby
8
star
14

aiconvo

Conversations between OpenAI and Google PaLM2 models
Ruby
8
star
15

ajaxform

ajaxForm jQuery plugin for submitting and validating forms via AJAX
JavaScript
7
star
16

cryptor

πŸ” AES GCM encryption functions in Dart language
Dart
7
star
17

RouteJS

JavaScript routing for non-SPA applications
CoffeeScript
6
star
18

applepie-rails

Semantic and Modular CSS Toolkit For Ruby On Rails
Ruby
5
star
19

polymer-iron-rails

Polymer Iron elements to use in your RoR apps
JavaScript
5
star
20

langchainrb-docs

Langchainrb Documenation
JavaScript
4
star
21

patterns

Common patterns of markup and style
CSS
3
star
22

maps.js

Easy and declarative way to use Google Maps API
CoffeeScript
3
star
23

module

πŸ“¦ Optimal skeleton/boilerplate for a new Node.js module
JavaScript
2
star
24

alchaplinsky

1
star
25

smartstart

Sass OOCSS library
Ruby
1
star
26

tetris

JavaScript
1
star
27

spectr

Javascript library that handles a certain specter of functionality:)
CoffeeScript
1
star
28

rtfm

Small and Classy PHP MVC Framework
PHP
1
star
29

picasa_albums

Ruby
1
star
30

eventBinder

Simple Javascript library to handle events
JavaScript
1
star
31

terraform-sandbox

HCL
1
star