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.

view-scoped CSS via JSS

See original GitHub issue

Now that view closures can return {render: ...} objects, we should evaluate offering the option of returning {css: ...} as part of the mix, possibly accepting a JSS-style [1] stylesheet definition. Each vm is already tagged with a globally unique sequential .id, so the styles can be prefixed to isolate/prevent leakage. Another option is to prefix the defs with the function.name of the the view closure. This means all views created using the same closure would by styled uniformly. In both cases the view’s root nodes would need the generated prefixes auto-appended to their className.

JSS pairs well with vdom/hyperscript style libs since it’s js-assembled CSS, much like like js-assembled DOM.

This would make for a good isolated and high-ROI project if anyone wants to take charge, since it wouldn’t require intricate familiarity with domvm’s internals. 98% of it can live decoupled as an addon.

cc @grumpi, @yosbelms, @lawrence-dol

[1] https://github.com/cssinjs/jss

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:44 (17 by maintainers)

github_iconTop GitHub Comments

2reactions
lawrence-dolcommented, Dec 7, 2016

In my opinion, the ‘C’ in CSS stands for a vulgar term referring to unwilling intercourse with a group of assailants. But we are stuck with it because our industry can’t, as a group, design it’s way out of a paper bag.

They almost partly fixed this with the introduction of <style scoped> and then someone realized that this would make too many developers’ lives easier and unceremoniously kiboshed it, throwing the baby out with the bathwater instead of recognizing that the suggestion reveals a gaping problem with the current state of the art (art is used loosely here).

As a whole, we still haven’t collectively recognized that the “specificity” rules aren’t rules, but more guidelines for the partly-insane and savants among us. Add to this that the cascade refers to seepage of unintended side-effects that make even the most well meaning effort devolve into gibberish with 6 weeks of having been written.

So we continue to pursue the heights of madness, ever courting danger on the brink of despair, in an everlasting effort, doomed to ultimate failure, to write sane, maintainable styles to control the visuals of an application, using tools designed to produce documents. BECAUSE THERE’S NOTHING ELSE.

So yes, we should wrestle with this until we can do something better, or realize that doing the same thing using a different syntax is folly.

(rant over)

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get @ViewScoped bean property in CSS resource?
In my JSF page I can access the property color by #{testBean.color} , but in my CSS resource it doesn't work. ... If...
Read more >
Scoped CSS - Vue Loader
Webpack loader for single-file Vue components.
Read more >
@ViewScoped behaves like @SessionScoped - Prime ...
Hi, I was using p:layout and menu items. No we are migrating to PF sentinel. The problems is we are loading the pages...
Read more >
Richfaces 4 ui:include not load Javascript and ...| JBoss.org Content ...
@ViewScoped has another problem with c:forEach that backingbean will create every request. And dynamic rich:tab hava to use c:forEach. So I only can...
Read more >
CSS features reference - Chrome Developers
Discover new workflows for viewing and changing CSS in Chrome DevTools. ... View @scope at-rules. The Styles pane shows you CSS @scope ...
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