• This repository has been archived on 27/Jan/2019
  • Stars
    star
    161
  • Rank 233,470 (Top 5 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 9 years ago

Reviews

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

Repository Details

Package web components in Rails applications using the asset pipeline

Thank you to everyone who's helped make, fix, and spread this gem! Unfortunately, I no longer have the need or motivation to work on it, anymore. Sorry!

This project is no longer under development.


Emcee

Emcee is an extension to the Rails Asset Pipeline. It allows you to import and package web components exactly as you would Javascript or CSS.

Table of contents

Installation

Add Emcee to your Gemfile:

gem 'emcee'

and then execute:

$ bundle install

Finally, run:

$ rails generate emcee:install

This will insert <%= html_import_tag "application" %> into your application layout. Also, it will create 'components' directories under '/assets' and '/vendor/assets'.

Usage

Once installed, you will have a manifest file located at /assets/components/application.html. Use sprockets directives to include web components located in one of the assets directories.

When referencing web components, you must point to an html file, not a directory. For example, if you have a sub-directory like this:

vendor
|- assets
  |- components
    |- ui-tabs
       |- ui-tabs.html

You must reference this in the manifest file as:

*= require ui-tabs/ui-tabs

Compilation

Emcee works great with compiling assets, such as CoffeeScript and Sass. Any external stylesheet or script tag references that have an extension that Sprockets recognizes will automatically be compiled.

For example, <link rel="stylesheet" href="test.css.scss"> and <script src="test.js.coffee"> will be respectively compiled to CSS and Javascript.

Bower

When installed, Emcee configures Bower to install components to vendor/assets/components. Anything installed with bower can be referenced directly in your application.js, application.css, or application.html manifest files.

Concatenation

In a development environment, all web components referenced in the manifest will be included in the application as seperate html imports. Importing web components a.html, b.html, and c.html will result in:

<link rel="import" href="a.html">
<link rel="import" href="b.html">
<link rel="import" href="c.html">

In production, they will be concatenated into one import, and will have comments and blank lines removed.

<link rel="import" href="application-908e25f4bf641868d8683022a5b62f54.html">

Notice the fingerprint hash appended to the file name. This depends on the contents of the included web components, and allows proper caching and cache-busting.

Testing

To run the tests, simply run rake test.

Contributing

  1. Fork it
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a new Pull Request

Special Thanks

Special thanks to the Polymer Project, which Emcee was designed to work with. They've designed an amazing piece of technology that will change how web apps are made.

More Repositories

1

raycast

HTML5 raycasting demo using React
JavaScript
348
star
2

brackets-indentator

Re-indent documents in Adobe Brackets according to your current tab settings
JavaScript
39
star
3

brackets-paste-and-indent

Paste code at the correct indentation level
JavaScript
30
star
4

vacation

Employee vacation tracker
Ruby
15
star
5

raytrace2

Implementation of ray tracer from Ray Tracing in One Weekend
TypeScript
14
star
6

sicp

Exercises and notes from Structure and Interpretation of Computer Programs
JavaScript
12
star
7

preview-tabs

Sublime-style preview tabs for Atom
CoffeeScript
11
star
8

conway4

Conway's game of life in TypeScript, based on Michael Abrash's description in Graphics Programming Black Book
TypeScript
7
star
9

orbital

Physics simulation in React
JavaScript
4
star
10

conway

Cellular Automata demonstration in React.
TypeScript
3
star
11

cog

Interactive SVG
JavaScript
3
star
12

emitter-gates

EventEmitter-based logic gates
TypeScript
3
star
13

waves

React sine waves
JavaScript
2
star
14

automata

Elementary cellular automata
TypeScript
2
star
15

jasmine-runner

Run Jasmine specs from within Atom
CoffeeScript
2
star
16

the-little-typescripter

The Little Schemer implemented in Typescript
TypeScript
2
star
17

euchre

Euchre card game written in React
TypeScript
2
star
18

raytrace

Raytracer in Javascript and React
JavaScript
1
star
19

standfast

✉ 🤘 Collect and share status reports via email
Ruby
1
star
20

frostbite

Tiny, experimental economy "game"
TypeScript
1
star
21

islands

Battleship game from Functional Web Development with Elixir, OTP, and Phoenix
Elixir
1
star
22

chip-8

Chip-8 interpreter in TypeScript
TypeScript
1
star
23

tetris

Classic Tetris game
TypeScript
1
star
24

ahuth.github.io

Personal homepage
TypeScript
1
star
25

lua-ts

TypeScript implementation of the minimal Lua from https://notes.eatonphil.com/lua-in-rust.html
HTML
1
star
26

evolved-salesman

Traveling salesman problem solved by a genetic algorithm
JavaScript
1
star
27

bit-adder

Binary adding machine
TypeScript
1
star