Time is passing by

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.


Me Myself and I

Many years ago, I worked for my parents who own a video production company. Because it is a family business, you inevitably end up wearing many hats and being the czar of many different jobs. I mainly managed projects and worked as a video editor. On production, there were times that I was called on to work as an audio tech and was made to wear headphones on long production days. In those days, having a really good set of headphones that picked up every nuance of sound was essential to making sure the client got what they needed.

First impressions.

Naturally, my first impression of these headphones is based off of the look of them. They have a classic over-the-ear style that is highlighted by a blue LED light that indicates the power for the noise canceling. The padding on the ear pieces seems adequate for extended usage periods.
They are wired headphones, but the 3.5mm stereo mini-plug cable is detachable. Something else I noticed right of the bat was the very nice carrying case that comes with them. It has a hard plastic exterior with a soft cloth interior that helps to protect the surface of the headphones from scratches. I never truly appreciated cases for headphones until I started carrying them from place-to-place. Now I can’t imagine not having a case.

A perfect fit.

Once I gave the headphones a thorough once-over exam, I tried them on. As I mentioned, they have a classic over-the-ear style and just looking at them, the padding on the ear pieces seem adequate and the peak of the headband seemed to be a bit lacking, but you don’t really know comfort unless you try on the product. So, I slipped the headphones on and found them to be exquisitely comfortable.

It’s safe to say that because of my unique professional experiences, I’ve tested out a lot of headphones.

Quality.

Now that I had the headphones on my head, I was finally ready to plug and play some music. I plugged the provided cable into the jack on the headphones and then the one on my iPhone 6. Then I called up Pandora. I tend to have a very eclectic music purview and have many stations set up for different moods. From John Williams to Fallout Boy, the sound quality of these headphones was remarkable. There is an amazing depth of sound and incredible highs and lows that make listening to music a truly breathtaking experience.

In order to test how voices sounded, and the overall art of sound mixing, I pulled up Netflix on my iPad Air 2 and watched a few minutes of a movie to hear all the nuances of the film. None of them were lost. In fact, I ended up hearing sounds that I hadn’t heard before. Echoes…birds chirping…wind blowing through trees…breathing of the characters…it was very impressive what the headphones ended up bringing out for me.

I would highly recommend these to any sound mixing specialist.


Sounds from the streets

Many years ago, I worked for my parents who own a video production company. Because it is a family business, you inevitably end up wearing many hats and being the czar of many different jobs. I mainly managed projects and worked as a video editor. On production, there were times that I was called on to work as an audio tech and was made to wear headphones on long production days. In those days, having a really good set of headphones that picked up every nuance of sound was essential to making sure the client got what they needed.

It’s safe to say that because of my unique professional experiences, I’ve tested out a lot of headphones.

First impressions.

Naturally, my first impression of these headphones is based off of the look of them. They have a classic over-the-ear style that is highlighted by a blue LED light that indicates the power for the noise canceling. The padding on the ear pieces seems adequate for extended usage periods.

They are wired headphones, but the 3.5mm stereo mini-plug cable is detachable. Something else I noticed right of the bat was the very nice carrying case that comes with them. It has a hard plastic exterior with a soft cloth interior that helps to protect the surface of the headphones from scratches. I never truly appreciated cases for headphones until I started carrying them from place-to-place. Now I can’t imagine not having a case.

A perfect fit.

Once I gave the headphones a thorough once-over exam, I tried them on. As I mentioned, they have a classic over-the-ear style and just looking at them, the padding on the ear pieces seem adequate and the peak of the headband seemed to be a bit lacking, but you don’t really know comfort unless you try on the product. So, I slipped the headphones on and found them to be exquisitely comfortable.

Quality.

Now that I had the headphones on my head, I was finally ready to plug and play some music. I plugged the provided cable into the jack on the headphones and then the one on my iPhone 6. Then I called up Pandora. I tend to have a very eclectic music purview and have many stations set up for different moods. From John Williams to Fallout Boy, the sound quality of these headphones was remarkable. There is an amazing depth of sound and incredible highs and lows that make listening to music a truly breathtaking experience.

In order to test how voices sounded, and the overall art of sound mixing, I pulled up Netflix on my iPad Air 2 and watched a few minutes of a movie to hear all the nuances of the film. None of them were lost. In fact, I ended up hearing sounds that I hadn’t heard before. Echoes…birds chirping…wind blowing through trees…breathing of the characters…it was very impressive what the headphones ended up bringing out for me.

I would highly recommend these to any sound mixing specialist.


Some amazing buildings

Minimalism and geometric.

When you are alone for days or weeks at a time, you eventually become drawn to people. Talking to randos is the norm. I’ll never forget the conversation with the aquarium fisherman, forest ranger, and women at the Thai market. It’s refreshing to compare notes on life with people from vastly different backgrounds.

When you meet fellow travelers, you’ll find they are also filled with a similar sense of adventure and curiosity about the world. Five days of friendship on the road is like five months of friendship at home. It’s the experiences that bond you together, not the place. A rule I followed that worked well: be the first to initiate conversation. I met some incredible people by simply being the first to talk.

Long term travel is different than a luxury vacation. The point is to see the world, not stay in a 5-star hotel. During the trip, I stayed on a strict budget. The goal was to spend no more than $33 per day on accommodations. After a year, I was able to spend only $26.15 per day by booking through HostelWorld and Airbnb. When I wanted to meet people, I’d stay in a shared room at a hostel. When I wanted to be alone, I’d book a private room with Airbnb.

Take the cost of your rent or mortgage + food per month and divide it by 30. This is how much it costs per day to live at home. You will find that it’s possible to travel the world for roughly the same amount. Or, if you live in an expensive city like San Francisco, far less.

An universal language.

I was surprised how many people spoke English (apparently 1.8 billion people worldwide). Places where English was less prevalent, I made an effort to learn a handful of words and phrases in the local language. Even though it’s passable, I do desire to learn another language fluently. You can only take the conversation so far when all you can say is: “¿Esto contiene gluten?”

It’s possible to communicate a lot without saying a word. For instance, I left my phone at a restaurant in Chile. I pointed at the table where I was sitting, put my hand to my ear like a phone, then shrugged — 2 minutes later, my phone had been retrieved.


Trust in your intuitions

Once I gave the headphones a thorough once-over exam, I tried them on. As I mentioned, they have a classic over-the-ear style and just looking at them, the padding on the ear pieces seem adequate and the peak of the headband seemed to be a bit lacking, but you don’t really know comfort unless you try on the product. So, I slipped the headphones on and found them to be exquisitely comfortable. Once I gave the headphones a thorough once-over exam, I tried them on. As I mentioned, they have a classic over-the-ear style and just looking at them, the padding on the ear pieces seem adequate and the peak of the headband seemed to be a bit lacking, but you don’t really know comfort unless you try on the product. So, I slipped the headphones on and found them to be exquisitely comfortable.

If no one hates you, no one is paying attention. If attention is what you want for vanity, confidence, or, hell — to make a decent living — then know that it’s not instantaneous. Every single person that you’re currently paying attention to, at some point in their lives, was in your exact position.

You need to be
true to yourself

Just like every other human on the planet, I have epically awesome days and days when life just turne against me. And while I can’t stand most self-help (see: tired quotes over stock photography on Instagram), sometimes I need a little pick-me-up. And most of the time, in order to get out of a slump (because my brain leans more into math/science than anything else), I need to drop a logic bomb on my ass.

Yes, this is a long article. But here’s the thing — if you’re reading this in your inbox and are already like, “fuck this!” delete it. No hard feelings. If you’re reading this in a browser on a website, and you see how tiny the scroll-bar is because of how far you still have to scroll to get to the bottom, close this tab and go back to 140-character tidbits of advice. Still with me? Phew. Just had to weed out all the folks from points: #1, #4 and #8. Welcome friends, onward we go.

Remember to
never give up

If no one hates you, no one is paying attention. If attention is what you want for vanity, confidence, or, hell — to make a decent living — then know that it’s not instantaneous. Every single person that you’re currently paying attention to, at some point in their lives, was in your exact position. They kept at it and worked enough so that others started listening. Also know that if no one is watching, you can experience true freedom. Dance in your underwear. Write entirely for yourself. Like there’s a going-out-of-business sale. Find yourself — not in some coming-of-age hippie way involving pasta and ashrams— but in a way that helps you draw your own line in the sand for what matters and what doesn’t. Do what you want to do, just because you want to do that thing. This will build confidence that will come in handy later.

Once I gave the headphones a thorough once-over exam, I tried them on. As I mentioned, they have a classic over-the-ear style and just looking at them, the padding on the ear pieces seem adequate and the peak of the headband seemed to be a bit lacking, but you don’t really know comfort unless you try on the product. So, I slipped the headphones on and found them to be exquisitely comfortable. Once I gave the headphones a thorough once-over exam, I tried them on. As I mentioned, they have a classic over-the-ear style and just looking at them, the padding on the ear pieces seem adequate and the peak of the headband seemed to be a bit lacking, but you don’t really know comfort unless you try on the product. So, I slipped the headphones on and found them to be exquisitely comfortable.

If no one hates you, no one is paying attention. If attention is what you want for vanity, confidence, or, hell — to make a decent living — then know that it’s not instantaneous. Every single person that you’re currently paying attention to, at some point in their lives, was in your exact position. They kept at it and worked enough so that others started listening. Also know that if no one is watching, you can experience true freedom. Dance in your underwear. Write entirely for yourself. Like there’s a going-out-of-business sale. Find yourself — not in some coming-of-age hippie way involving pasta and ashrams— but in a way that helps you draw your own line in the sand for what matters and what doesn’t. Do what you want to do, just because you want to do that thing. This will build confidence that will come in handy later.