百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
E

emcee

> 编程语言
开源

使用资产管道在 Rails 应用中打包 Web 组件

158 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

使用资产管道在 Rails 应用中打包 Web 组件

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
  • Usage
  • Compilation
  • Bower
  • Concatenation
  • Testing
  • Contributing
  • Special thanks

Installation

Add Emcee to your Gemfile:

gem 'emcee'

and then execute:

$ bundle install

Finally, run:

$ rails generate emcee:install

This will insert `` 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, and 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:

xml

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

xml

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.

Issues· 9 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言