question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ember-component-css 1.0 game plan

See original GitHub issue

Note: This issue is a WIP, it will be updated over time


I wanted to start collecting my thoughts and gather feedback from the community for ember-component-css 1.0.

Here are some of the high level plans:

  • Support classic & future modules RFC file structures
  • Auto-BEM
  • Linting
  • Shadow DOM forward compatibility
  • JS module API

Support classic & future modules RFC file structures

I think this is self explanatory 😛

Auto-BEM

ember-component-css currently works via automatically nesting your rules underneath a generated class. This was easy implementation wise, but it was never my intent for that to remain the primarily implementation strategy. I instead would like to switch to auto-BEM’ing rules (see http://getbem.com/naming/ for more info). Using BEM naming ensures styles don’t leak outside of the component’s template.

Here’s an example showing input and current / future output.

input:

.foo {}

current output:

.my-component .foo {}

future output:

.my-component--foo {}

(there will probably also be a hash included in the class name)

Linting

We should devise a set of best practices and warn folks when they’ve gone off the happy path. Things that come to mind are using IDs and unsafe descendent selectors.

Shadow DOM forward compatibility

I would like users to be able to turn off auto-BEM’ing if they’re shipping to browsers that support shadow DOM. I would also like to explore being able to generate individualized component CSS builds that can be loaded into component’s shadow roots.

I don’t think I want to polyfill any Shadow DOM functionality, instead I just want to make sure we’re not making any decisions that make it hard to take our styles in the future and use them inside of a shadow root.

JS module API

It would be nice to be able to import CSS files from inside of JS files, ala css-modules. This can be useful for accessing the rewritten/generated class names for usage within JS code.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:7
  • Comments:35 (12 by maintainers)

github_iconTop GitHub Comments

3reactions
buschtoenscommented, Jul 28, 2017

I believe most of the Ember core team believes Sass is the preprocessor we should focus our support on

I would also like to know, why you’ve come to that conclusion. Is it because of the Ruby background? 😛

I would also suggest going for PostCSS, instead of Sass. PostCSS is a JavaScript project. As such, it seems to be more popular in the JS community and it’s easier to extend for the typical frontend developer. Also, if GitHub stars mean anything:

As far as I’m concerned, PostCSS has full feature parity with Sass. There even are some addons that enable sassy syntax. 🙂

2reactions
webarkcommented, Jul 29, 2017

@t4t5 ember-component-css has no desire or direction to becoming a sass framework. It in fact uses post-css to do its parsing.

But it also is not a post css plugin, nor does it desire to be, at least at this time.

In the css community there are mixed feelings and attitudes about many things, one being the world of css pre processors and plugin architecture is one of them.

A desire of this addon, at this time at least, is to be convention/preprocessor/plugin agnostic, and be a stepping stone for other solutions to potentially be built off of.

Future (hopeful) support for shadow dom, or even a js module api, would be inline with this desire. Auto BEM support would be something that would live in its own addon (in my opinion).

Read more comments on GitHub >

github_iconTop Results From Across the Web

webark/ember-component-css - GitHub
An Ember CLI addon which allows you to specify component-specific style sheets in an app, addon, engine, or in-repo addon. Contributions are welcome!...
Read more >
Building a Simple Component - Tutorial - Ember Guides
A template that defines how it will look ( app/templates/components/rental-listing.hbs ); A JavaScript source file ( app/components/rental-listing.js ) that ...
Read more >
ember-component-css - npm
An Ember CLI addon which allows you to specify styles for individual components. Latest version: 0.8.1, last published: 7 months ago.
Read more >
Ember.js Template Imports: Part 5 - Chris Krycho
This includes CSS Modules, styled components, Emotion, vanilla-extract, and no doubt more. Notably, many of these can also work with some of the ......
Read more >
Can a Ember.Component have both a block and non-block ...
Inside the Component you'd want to check the value of hasBlock {{#if hasBlock}} {{yield}} {{else}} <p>Default content for inline (non-block) form of the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found