GithubHelp home page GithubHelp logo

isabella232 / ember-component-css Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tabcorp/ember-component-css

0.0 0.0 0.0 91 KB

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

License: MIT License

JavaScript 87.24% CSS 2.08% HTML 10.67%

ember-component-css's Introduction

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) (the component must also provide a component.js returning a valid instance of Ember.Component).

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:

ember-component-css's People

Contributors

barneycarroll avatar buschtoens avatar cibernox avatar dcheng168 avatar dfreeman avatar ebryn avatar ember-tomster avatar ericschank avatar globegitter avatar hpstuff avatar indirect avatar jeffhertzler avatar noxmwalsh avatar odoe avatar pavloo avatar rwjblue avatar thedeeno avatar topaxi avatar trentmwillis avatar twokul avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.