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.

option for locally scoped styles

See original GitHub issue

I totally dig this pr in postcss-prefix, I think it makes the API for globals muchhhh cleaner and agree on changes that drop deps.

butttt I wonder if it would be cool to make a new possible option called local for example:

const html = require('choo/html')
const css = require('sheetify')

const styles = css('./component.css', { local: true})

module.exports = (state, prev, send) => html`
  <div class=${styles}>Yo!</div>
`

and the css is ./component.css is scoped to that particular component

whatchya think?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jakeburdencommented, Nov 30, 2016

awesome! thanks for taking the time to read my issue and for making sheetify, choo, bankai, and all those tools that make my dev stack 100% better

0reactions
yoshuawuytscommented, Nov 30, 2016

Ah yeah this seems reasonable. Given how small and transparent the feature is I’m in favor of adding it. PR welcome

On Wed, Nov 30, 2016, 03:38 Jacob Burden notifications@github.com wrote:

It’s indeed scoped with :host 😃 no bugs here, I’m just merely feature creeping haha

say with sheetify v5 I’ve imported a big css framework (job called for it, I would have used tachyons otherwise) so in the entry js file I have

css(‘…/node_module/big_css_framework/styles.css’, {global: true})

and then I have a bunch of component files like this

const html = require(‘choo/html’) const css = require(‘sheetify’)

const styles = css(‘./component.css’)

module.exports = (state, prev, send) => html`

<div class=${styles}>

Yo! This uses a class from that big css framework

</div> `

/* ./component.css */ .big-css-p-tags { font-size: 20px; // originally 18px in the framework but we want to overwrite it for just this component }

I can easily :host in front of .big-css-p-tags butttt I kind of would need to do this in a lot of files and on a lot of classes due to the way I did things with sheetify v5 orrr I can use nesting with postcss-cssnext to do something like

:host { // classes go here }

or I can add a specific class to each element, I have options I know, I’m just looking for the smoothest way to update my codebase and use coolio tooling like bankai 😃

this is just me wondering if anyone else did this with the last version of sheetify and maybe an option sorta like this would be good for those updating?

If not, thats cool! 🌴

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/stackcss/sheetify/issues/113#issuecomment-263766250, or mute the thread https://github.com/notifications/unsubscribe-auth/ACWlejc99SQiKNAianfFiEaF9nV5m0xJks5rDOGtgaJpZM4K_twx .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scoped CSS - Vue Loader
# Scoped CSS · # Mixing Local and Global Styles · # Child Component Root Elements · # Deep Selectors · # Dynamically...
Read more >
Locally Scoped CSS Variables: What, How, and ... - Una Kravets
CSS Custom Properties (also popularly called CSS Variables) are here! This is really exciting because we finally have true variables in CSS!
Read more >
Saving the Day with Scoped CSS
The scope method allows you to keep those styles specific to the page they're needed on, without bloating your main stylesheet and having...
Read more >
scope - CSS: Cascading Style Sheets - MDN Web Docs
The :scope CSS pseudo-class represents elements that are a reference point for selectors to match against. Currently, when used in a stylesheet ...
Read more >
What is the current state of the "scoped" attribute for the style ...
This option also adds the possible advantage that if the browser does not understand the scoped attribute, the styles will not be applied...
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