ember-component-css-withbp

0.1.9 • Public • Published

ember-component-css Build Status

An Ember CLI addon which allows you to specify CSS inside of component pod directories

The announcement from EmberConf 2015 CSS is hard - EmberConf 2015

Installation

ember install ember-component-css

Usage

This addon allows you to specify a styles.css file inside of your component's pod folder (app/my-component/styles.css).

Rules defined inside of these styles.css files will automatically be namespaced with an autogenerated class. That autogenerated class will also be injected into your component's classNames property. This enables you to worry less about rules clashing across component styles.

For example, given this app/my-component/styles.css file:

{
  padding: 2px;
}
.urgent {
  color: red;
}

Your generated CSS output will look something like:

.my-component-a34fba {
  padding: 2px;
}
.my-component-a34fba .urgent {
  color: red;
}

A typical component invocation that looks like this:

{{my-component}}

will generated markup like:

<div class="my-component-a34fba"></div>

With Preprocessors

To use this addon with another preprocessor (such as Sass or Less), simply import pod-styles into your base app stylesheet.

For example, if you're using Sass:

// app/styles/app.scss 
@import "pod-styles";

And that is it! The pod-styles file is generated during the build and will then be pulled into your other stylesheet to be processed like normal.

Approved preprocessors:

Readme

Keywords

Package Sidebar

Install

npm i ember-component-css-withbp

Weekly Downloads

1

Version

0.1.9

License

MIT

Last publish

Collaborators

  • mnitchie