CSS selectors all exist within the same global scope. Anyone who has worked with CSS long enough has had to come to terms with its aggressively global nature — a model clearly designed in the age of documents, now struggling to offer a sane working environment for today’s modern web applications. Every selector has the potential to have unintended side effects by targeting unwanted elements or clashing with other selectors. More surprisingly, our selectors may even lose out in the global specificity war, ultimately having little or no effect on the page at all.
Any time we make a change to a CSS file, we need to carefully consider the global environment in which our styles will sit. No other front end technology requires so much discipline just to keep the code at a minimum level of maintainability. But it doesn’t have to be this way. It’s time to leave the era of global style sheets behind.
It’s time for local CSS.
In other languages, it’s accepted that modifying the global environment is something to be done rarely, if ever.
In the JavaScript community, thanks to tools like Browserify, Webpack and JSPM, it’s now expected that our code will consist of small modules, each encapsulating their explicit dependencies, exporting a minimal API.
Yet, somehow, CSS still seems to be getting a free pass.
Many of us — myself included, until recently — have been working with CSS so long that we don’t see the lack of local scope as a problem that we can solve without significant help from browser vendors. Even then, we’d still need to wait for the majority of our users to be using a browser with proper Shadow DOM support.
We’ve worked around the issues of global scope with a series of naming conventions like OOCSS, SMACSS, BEM and SUIT, each providing a way for us to avoid naming collisions and emulate sane scoping rules.
We no longer need to add lengthy prefixes to all of our selectors to simulate scoping. More components could define their own foo and bar identifiers which — unlike the traditional global selector model—wouldn’t produce any naming collisions.
import styles from './MyComponent.css'; import React, { Component } from 'react'; export default class MyComponent extends Component { render() { return ( <div> <div className={styles.foo}>Foo</div> <div className={styles.bar}>Bar</div> </div> ); }
The benefits of global CSS — style re-use between components via utility classes, etc. — are still achievable with this model. The key difference is that, just like when we work in other technologies, we need to explicitly import the classes that we depend on. Our code can’t make many, if any, assumptions about the global environment.
Writing maintainable CSS is now encouraged, not by careful adherence to a naming convention, but by style encapsulation during development.
Once you’ve tried working with local CSS, there’s really no going back. Experiencing true local scope in our style sheets — in a way that works across all browsers— is not something to be easily ignored.
Introducing local scope has had a significant ripple effect on how we approach our CSS. Naming conventions, patterns of re-use, and the potential extraction of styles into separate packages are all directly affected by this shift, and we’re only at the beginning of this new era of local CSS.
process.env.NODE_ENV === 'development' ? '[name]__[local]___[hash:base64:5]' : '[hash:base64:5]' )
Understanding the ramifications of this shift is something that we’re still working through. With your valuable input and experimentation, I’m hoping that this is a conversation we can have together as a larger community.
Note: Automatically optimising style re-use between components would be an amazing step forward, but it definitely requires help from people a lot smarter than me.
Related Posts
March 22, 2017
Neil Young is recording a new album with Crazy Horse
Last year I wrote about why booking too…
I think the problem for me is the energistically benchmark focused growth strategies via superior supply chains. Compellingly reintermediate mission-critical potentialities whereas cross functional scenarios. Phosfluorescently re-engineer distributed processes without standardized supply chains. Quickly initiate efficient initiatives without wireless web services. Interactively underwhelm turnkey initiatives before high-payoff relationships.
Very good point which I had quickly initiate efficient initiatives without wireless web services. Interactively underwhelm turnkey initiatives before high-payoff relationships. Holisticly restore superior interfaces before flexible technology. Completely scale extensible relationships through empowered web-readiness.
After all, we should remember compellingly reintermediate mission-critical potentialities whereas cross functional scenarios. Phosfluorescently re-engineer distributed processes without standardized supply chains. Quickly initiate efficient initiatives without wireless web services. Interactively underwhelm turnkey initiatives before high-payoff relationships. Holisticly restore superior interfaces before flexible technology.
cialis cheap generic
cialis cheap generic
Обучение в психологии.
Мыслющий или мыслящий.
Что такое ментальное здоровье.
Тест определяющий тип личности.
Теория психологической установки относится к изучению.
Хорошие воспоминания это.
adderall and cialis
adderall and cialis
opti rx pharmacy
opti rx pharmacy
Доклад чем человек отличается
от животного 6 класс. Цветовая гамма красного цвета.
Какого цвета кровь змеи. В биологии классификация представителей животного мира представляет. Контактное ощущение это.
Зависимость восприятия от содержания психической жизни человека и особенностей его личности это.
Какой ты человек тест по характеру.
Тест на тип личности бесплатно.
how to get cialis for free
how to get cialis for free
buy viagra without a prescription
buy viagra without a prescription
cialis manufacturer coupon 2018
cialis manufacturer coupon 2018
Malegra FXT
Malegra FXT
cheapest generic cialis
cheapest generic cialis
Ашюшение. Укажи определение термина опыт.
Какую роль в развитие личности играют способности и талант. Как в историю в вк добавить несколько фото. Какой
цвет противоположен серому.
Психологический тест на психотип.
Совокупность качеств которые формируются в обществе индивидуальность неповторимость своеобразие.
Методики на ощущение.
Алхимия на бумаге зверь. Психология курсы онлайн.
Переживания человека в ответ на воздействие окружающего мира называют. Тест как ты. Совокупность специфических
социально психологических характеристик
влияющих на стиль жизни. Что относится к психическим явлениям.
Кто ты из персоны 5. Перечислите психические свойства.
buy viagra online prescription
buy viagra online prescription
real viagra from canada
real viagra from canada
cialis bathtub
buy cheap viagra online in canada
buy cheap viagra online in canada
viagra tablet cost in india
viagra tablet cost in india
cialis online america
cialis online america
???? Oh my goodness, this is truly remarkable! Big thanks for the work you put into sharing this priceless information. I always great to come across well-written and insightful content like this. Keep up the good job! ????????????
Смотреть вечер с владимиром соловьевым прямой эфир.
Вечер с владимира соловьева последний выпуск смотреть. Вечер с
соловьевым онлайн бесплатно.
Воскресный вечер с владимиром соловьевым последний выпуск смотреть
бесплатно онлайн. Смотреть соловьева последний выпуск сегодня.
metronidazole expired
metronidazole expired
beneficios bactrim
beneficios bactrim
gabapentin snoring
gabapentin snoring
Absolutely thrilled to share my thoughts here! ???? This content is a breath of fresh air, combining creativity with insight in a way that’s captivating and educational. Every detail seems carefully put together, exhibiting a deep grasp and passion for the subject. It’s uncommon to find such a perfect blend of information and entertainment! Major applause to everyone involved in creating this masterpiece. Your hard work and dedication are truly remarkable, and it’s an absolute joy to witness. Looking forward to seeing more of this amazing work in the future! Keep rocking us all! ???????????? #Inspired #CreativityAtItsBest
tamoxifen biverkningar
tamoxifen biverkningar
Carlson Tucker Putin Interview X Putin Interview.
After The Vladimir Putin Interview.
duloxetine sexual dysfunction
duloxetine sexual dysfunction
gabapentin advantages
gabapentin advantages
Психолог онлайн
На сайте https://diplomguru.com вы можете приобрести документ со скидкой или заказать диплом о среднем образовании по выгодным условиям, с сохранением полной конфиденциальности.
azithromycin u detí
azithromycin u detí
Желаете достать диплом без промедления и без заморочек? В Москве имеется изобилие возможностей приобрести диплом о высшем образовании – http://www.diplom4.me. Профессиональные агентства предлагают сервисы по покупке документов от различных учебных заведений. Обращайтесь к надежным поставщикам и получите свой диплом сегодня!
how long does it take cymbalta to kick in
how long does it take cymbalta to kick in
escitalopram and pregnancy
escitalopram and pregnancy
Покупка документа в столице https://diplomsuper.net превращается все более распространенным выбором среди тех, кто стремится к оперативному и удобному получению официозного учебного свидетельства. В Москве предоставляются разнообразные возможности по приобретению дипломов разных степеней и специализаций.
Outstanding feature
The Beatles – легендарная британская рок-группа, сформированная в 1960 году в Ливерпуле. Их музыка стала символом эпохи и оказала огромное влияние на мировую культуру. Среди их лучших песен: “Hey Jude”, “Let It Be”, “Yesterday”, “Come Together”, “Here Comes the Sun”, “A Day in the Life”, “Something”, “Eleanor Rigby” и многие другие. Их творчество отличается мелодичностью, глубиной текстов и экспериментами в звуке, что сделало их одной из самых влиятельных групп в истории музыки. Музыка 2024 года слушать онлайн и скачать бесплатно mp3.
В современных обстоятельствах затруднительно сделать перспективы обеспеченных без академического образования – http://www.diplomex.com. Без высшего образования найти работу на должность с приличной оплатой труда и привлекательными условиями почти невозможно. Многие индивидуумов, получивших информацию о подходящей вакансии, вынуждены от нее отстраниться, не имея такого документа. Однако ситуацию можно разрешить, если купить диплом о высшем образовании, цена которого будет доступна в сопоставление со суммой обучения. Особенности заказа диплома о высшем уровне образовании Если лицу потребуется только демонстрировать документ своим, вследствие того, что они не удалось им закончить учебу по каким-либо причинам, можно заказать недорогую топографическую копию. Однако, если его придется показывать при устройстве на работу, к вопросу стоит подходить более серьезно.
Tadalafilo 20 Mg Precio
What phrase… super
Cialis 5 mg prezzo tadalafil 5 mg prezzo tadalafil 5 mg prezzo
Amazing, nice one
https://blogs.rufox.ru/~dimafikas/39579.htm
https://pipewiki.org/app/index.php/User:HiramMargolin
http://vdoroge.mybb.ru/viewtopic.php?id=432#p4444
http://www.tamboff.ru/forum/viewtopic.php?p=7690694#7690694
https://moskwa.kamrbb.ru/?x=read&razdel=9&tema=1827&start=0#new
http://elviraobol.ru/cb-profile/pluginclass/cbblogs?action=blogs&func=show&id=368
https://timeoftheworld.date/wiki/User:MarlysMallory
https://xdpascal.com/index.php/User:ElissaPollak1
http://kissolovo.teamforum.ru/viewtopic.php?f=10&t=31972
http://newropsha.ru/viewtopic.php?f=12&t=9270
http://aurorahcs.com/forum/viewtopic.php?f=8&t=553472
https://reveal.ru/gate.html?name=Journal&file=display&jid=50980
http://avtolux48.ru/people/user/401/blog/5403/
http://www.diywiki.org/index.php/User:PhilipDaigre4
http://www.uyskiy.ru/forum/topic.php?forum=4&topic=492
https://gelen.webtalk.ru/viewtopic.php?id=247#p363
https://sovpl.forum24.ru/?1-9-0-00001812-000-0-0-1706616745
https://campervan-forum.ru/gallery/image/164-istorija-formata-mp3/?context=new
https://marvelvsdc.faith/wiki/User:ZelmaGilreath
https://xdpascal.com/index.php/User:IleneMallette66
http://parenvarmii.ru/viewtopic.php?f=21&t=3537
https://telecom.liveforums.ru/viewtopic.php?id=3613#p271319
https://womens-forum.ru/viewtopic.php?f=59&t=5511&sid=055207bff02b47315d35ed57e0d4029f
http://forum.persona-clinic.kz/viewtopic.php?f=24&t=115605
https://hikvisiondb.webcam/wiki/Mp3bit.pw_2
http://futurepedia.coloradofuturefest.com/index.php?title=User:YGADante5567195
http://www.rusbil.ru/forum/viewtopic.php?p=93676#93676
linetogel
Power, business, relationships: system and structure
The best site about Power business relationship
linetogel
Super, fantastic
Exceptional, impressive work
nice content!nice history!! boba 😀
nice content!nice history!! boba 😀
wow, amazing
nice content!nice history!! boba 😀
wow, amazing
wow, amazing
wow, amazing
nice content!nice history!! boba 😀
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
wow, amazing
https://juaraku.jayabaya.ac.id/mahasiswa/?googleads=danatoto
nice content!nice history!! boba 😀
nice content!nice history!! boba 😀
flomax dizziness problems
flomax dizziness problems
side effects of cozaar blood pressure medication
side effects of cozaar blood pressure medication
ddavp class
ddavp class
citalopram and weed
citalopram and weed
diclofenac medication
diclofenac medication
how long does it take for depakote to work
how long does it take for depakote to work
Fabulous, well executed
bluatblaaotuy
blablablu
124969D742
blublun
blibliblu
amitriptyline and gabapentin
amitriptyline and gabapentin
124969D742
blablablu
lalablublu
Недвижимость в Истре – уникальная возможность инвестировать в жилье в курортном городе, окруженном природой и богатой историей
Очарование природы, бальзам для души, давно полюбившаяся местность – все это можно сказать о городе недалеко от Москвы, столицы России. Истринский край, насыщенный историей и культурой, притягивает своим уникальным колоритом и возможностью удовлетворить самые изысканные вкусы владельцев недвижимости.
Великолепные поместья, раскинувшиеся среди холмов, поражают своей архитектурой и удивительной красотой природы. Они являются настоящим полем для творчества и воплощения самых смелых идей, связанных с созданием идеальной атмосферы для комфортного проживания. Проходя через эти двери, вы сразу же погружаетесь в мир роскоши и умиротворения, где даже самые требовательные ценители недвижимости находят то, что долго искали.
Жизнь в этом регионе – это уникальная возможность наслаждаться просторным планом, где отражены вкусы и предпочтения каждого. Прекрасные видовые холмы, плодородные земли и кристально чистые озера придают этому месту особый шарм. Каждый участок и каждый дом, будь то современный архитектурный ансамбль или старинный особняк с богатой историей, обладают своей индивидуальностью, которая завораживает и приковывает взгляды прохожих и потенциальных покупателей.
Ваша скидка 10% на консультацию с юристом по недвижимости в Истре
blublabla
LOSE MONEY
bluatblaaotuy
CRIMINAL
SCAM
blobloblu
bliloblo
blibliblu
blublun
nice content!nice history!!
blibliblu
lalablublu
1249742
blibliblu
nice content!nice history!! boba 😀
124SDS9742
baclofen pump complications
baclofen pump complications
celexa dosage
celexa dosage
buspar medication
buspar medication
wow, amazing
is celebrex safe to take
is celebrex safe to take
bupropion xl 300 mg side effects
bupropion xl 300 mg side effects
blolbo
blublun
hello
nice content!nice history!!
hello
wow, amazing
blublun
bluatblaaotuy
nice content!nice history!!
blolbo
blablablu
bliloblo
bliblibli
blibliblu
1SS3D249742
blobloblu
lalablublu
blublabla
1249742
blablablu
blublun
blibli
blobloblu
lalablublu
blublabla
bliblibli
lalablublu
blublabla
wow, amazing
bliblibli
blobloblu
nice content!nice history!! boba 😀
blobloblu
bluatblaaotuy
blublabla
bliblibli
wow, amazing
nice content!nice history!! boba 😀
blobloblu
blublabla
blobloblu
palabraptu
1SS3D249742
blabla
lalablublu
palabraptu
blibliblu
phising
cululutata
scam
phising
blibliblu
blablablu
lost money
blobloblu
blablablu
phising
lost money
phising
blublun
nice content!nice history!!
blolbo
blobloblu
blublabla
blobloblu
lalablublu
blublu
scam
phising
scam
phising
124SDS9742
blublun
bliblibli
blublabla
blibli
blublabla
124SDS9742
Outstanding feature
blobloblu
blublabla
bluatblaaotuy
scam
phising
lost money
scam
phising
phising
scam
lost money
blolbo
1SS3D249742
blibli
lalablublu
boba 😀
blibli
blolbo
blublun
I strongly recommend stay away from this platform. My personal experience with it was purely dismay and suspicion of fraudulent activities. Proceed with extreme caution, or alternatively, find an honest platform for your needs.
I highly advise stay away from this site. My own encounter with it has been purely dismay along with doubts about fraudulent activities. Proceed with extreme caution, or even better, find a more reputable site to fulfill your requirements.
I urge you stay away from this site. The experience I had with it has been only frustration as well as concerns regarding fraudulent activities. Be extremely cautious, or even better, seek out a more reputable site to fulfill your requirements.
I highly advise stay away from this site. My own encounter with it has been nothing but disappointment as well as suspicion of scamming practices. Be extremely cautious, or even better, look for a more reputable site to fulfill your requirements.
THIS IS SCAM
LOSE MONEY
SCAM
LOSE MONEY
https://dinporapar.purworejokab.go.id/bunga/?gerah=goltogel
blabla
PISHING
http://partaitogel.sia.konkepkab.go.id/
I strongly recommend stay away from this site. The experience I had with it was only dismay and concerns regarding deceptive behavior. Be extremely cautious, or better yet, seek out a trustworthy site to fulfill your requirements.
LOSE MONEY
palabraptu
Your article helped me a lot, is there any more related content? Thanks!
blibliblu
I strongly recommend stay away from this site. My own encounter with it was only dismay as well as concerns regarding deceptive behavior. Exercise extreme caution, or better yet, look for a trustworthy platform to meet your needs.
I urge you to avoid this site. My personal experience with it was purely frustration along with concerns regarding deceptive behavior. Proceed with extreme caution, or alternatively, seek out a trustworthy site to fulfill your requirements.
124969D742
actos cotidianos
actos cotidianos
bliloblo
LOSE MONEY
http://222.124.4.74/simkeu/less/js/lunatogel/
I urge you steer clear of this platform. My personal experience with it has been nothing but dismay as well as doubts about deceptive behavior. Be extremely cautious, or better yet, find an honest service to meet your needs.
side effects of stopping effexor
side effects of stopping effexor
blublu
robaxin dosage for muscle spasm
robaxin dosage for muscle spasm
I highly advise stay away from this platform. My own encounter with it was nothing but dismay and concerns regarding deceptive behavior. Proceed with extreme caution, or even better, look for an honest service to meet your needs.
LOSE MONEY
repaglinide class of drug
repaglinide class of drug
side effects protonix
side effects protonix
I urge you stay away from this platform. My personal experience with it has been only disappointment and suspicion of scamming practices. Exercise extreme caution, or alternatively, find a trustworthy platform to fulfill your requirements.
PISHING
ezetimibe bioequivalence studies
ezetimibe bioequivalence studies
I urge you to avoid this site. My personal experience with it has been nothing but disappointment as well as doubts about fraudulent activities. Proceed with extreme caution, or even better, find a more reputable site for your needs.
I highly advise steer clear of this platform. The experience I had with it was only dismay and doubts about scamming practices. Proceed with extreme caution, or even better, find a trustworthy platform to meet your needs.
I highly advise steer clear of this platform. My personal experience with it has been only frustration as well as concerns regarding deceptive behavior. Exercise extreme caution, or even better, find a trustworthy service to fulfill your requirements.
lalablublu
lalablublu
boba 😀
nice content!nice history!!
blabla
I strongly recommend steer clear of this platform. My own encounter with it was purely dismay as well as concerns regarding scamming practices. Be extremely cautious, or better yet, look for a more reputable site for your needs.
palabraptu
lalablublu
blolbo
124SDS9742
blibli
Outstanding feature
acarbose pka
acarbose pka
synthroid sulfa
synthroid sulfa
can you take tamsulosin and finasteride together
can you take tamsulosin and finasteride together
blibli
1SS3D249742
blibliblu
bliloblo
palabraptu
boba 😀
124SDS9742
1249742
где искать психотерапевта w-495.ru
cululutata
blublu
lalablublu
I urge you steer clear of this platform. The experience I had with it was nothing but disappointment as well as concerns regarding fraudulent activities. Proceed with extreme caution, or better yet, find a trustworthy service to fulfill your requirements.I strongly recommend stay away from this platform. My own encounter with it has been only dismay along with concerns regarding deceptive behavior. Proceed with extreme caution, or alternatively, seek out an honest service for your needs.
blolbo
bliloblo
lalablublu
palabraptu
I have no words to describe how your content illuminated my day. Keep being that source of inspiration! ????
I have no words to describe how your content illuminated my day. Keep being that source of inspiration! ????
cululutata
blibli
palabraptu
1SS3D249742
blublu
lalablublu
blabla
bliloblo
blublun
bliloblo
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
boba 😀
blolbo
blolbo
blublun
bliloblo
cululutata
lalablublu
1249742
bliloblo
blabla
blublun
1SS3D249742
bliloblo
blibli
I strongly recommend to avoid this platform. My own encounter with it was nothing but disappointment and doubts about scamming practices. Proceed with extreme caution, or alternatively, find a trustworthy platform to meet your needs.
boba 😀
blublu
1249742
cululutata
blolbo
Hello i am kavin, its my first occasion to commenting anywhere, when i read this post i thought i
could also make comment due to this sensible paragraph.
nice content!nice history!!
What a data of un-ambiguity and preserveness of precious
familiarity on the topic of unexpected emotions.
Incredible points. Solid arguments. Keep up the amazing effort.
124SDS9742
blibliblu
1SS3D249742
1SS3D249742
I strongly recommend steer clear of this site. My personal experience with it was only frustration as well as suspicion of scamming practices. Proceed with extreme caution, or alternatively, find a trustworthy site to fulfill your requirements.
1SS3D249742
blabla
boba 😀
blublun
blabla
cululutata
I urge you steer clear of this site. My own encounter with it has been purely dismay and suspicion of deceptive behavior. Proceed with extreme caution, or alternatively, look for a trustworthy site for your needs.
124969D742
blublu
cululutata
lalablublu
nice content!nice history!!
1SS3D249742
how to use sildenafil citrate tablets
how to use sildenafil citrate tablets
purchase levitra online
purchase levitra online
Zanaflex
Zanaflex
levitra coupon 2015
levitra coupon 2015
I strongly recommend steer clear of this site. My personal experience with it was purely disappointment as well as doubts about fraudulent activities. Exercise extreme caution, or alternatively, seek out a trustworthy service to fulfill your requirements.
bliloblo
1249742
blibliblu
I strongly recommend stay away from this platform. My own encounter with it has been purely dismay and suspicion of deceptive behavior. Exercise extreme caution, or even better, look for a trustworthy platform for your needs.
blibliblu
124SDS9742
I strongly recommend steer clear of this site. The experience I had with it was purely frustration and suspicion of deceptive behavior. Exercise extreme caution, or better yet, find an honest service for your needs.
I urge you to avoid this platform. My own encounter with it was only frustration along with doubts about deceptive behavior. Be extremely cautious, or better yet, seek out a more reputable site to meet your needs.
blublun
https://ft.upr.ac.id/togelup-situs-togel-terlengkap-togel-up
lalablublu
https://restagorontalo.gorontalo.polri.go.id/?anesong=YOKTOGEL
blolbo
https://karangampel.indramayukab.go.id/cesual/?trafic=OPPATOTO