benschwarz / metaquery

A declarative responsive web design syntax. Breakpoints, defined in `<meta>`
MIT License
324 stars 25 forks source link

Suggestion for naming breakpoints #21

Closed Elbone closed 10 years ago

Elbone commented 10 years ago

My colleague wants to be able to pass an option to set the "breakpoint-" prefix as she likes to use all caps class names for the media queries, which to be honest is not a bad idea as it visually identifies the media query.

To continue the configuration paradigm perhaps it could be a meta tag: <meta name="breakpoint-prefix" content="BP_" >

It could also allow us to use such values as @media-. This will be targeted in css with .\@media-tablet .selector { } making it immediately recognisable as a (non-standard) media query.

Elbone commented 10 years ago

eg: https://gist.github.com/Elbone/e5b79f02d7e77851aca5 https://gist.github.com/Elbone/b9bffeffe79a3ada3221

benschwarz commented 10 years ago

I'm not 100% convinced by your proposal (or using @media)… BUT, it is an interesting parellel to the custom media queries specification.

geelen commented 10 years ago

Nice idea, but using @ in class names gives me the heeby jeebies :)

Personally I find .breakpoint- to be a clear enough signal throughout the CSS, but I can see how you might want to use a different style

On Tuesday, June 24, 2014, Niels Oeltjen notifications@github.com wrote:

My colleague wants to be able to pass an option to set the "breakpoint-" prefix as she likes to use all caps class names for the media queries, which to be honest is not a bad idea as it visually identifies the media query.

To continue the configuration paradigm perhaps it could be a meta tag:

It could also allow us to use such values as @media-. This will be targeted in css with .\@media-tablet .selector { } making it immediately recognisable as a (non-standard) media query.

— Reply to this email directly or view it on GitHub https://github.com/benschwarz/metaquery/issues/21.

Elbone commented 10 years ago

I know what you mean @geelen but I figured the option to use a custom prefix is the key feature. I personally would just use all caps. It's just more scannable and makes the selector stand out to other devs as being unusual.

benschwarz commented 10 years ago

The other thing you could do to make the selector standout, is qualify the selector to :root or something like that.

:root.breakpoint-handheld {  }

Otherwise, I'd be amenable to a PR that added the ability to set a prefix… could be done on a metatag just like the rest of metaquery, but a direct JavaScript API would be fine too.

metaQuery.selectorPrefix = 'BP-'

Agree with @geelen's sentiments of @media giving a slightly uncomfortable feeling. Seems like a bad idea.

Elbone commented 10 years ago

@benschwarz @geelen Agreed! @media was a bad idea :-) See https://gist.github.com/Elbone/b9bffeffe79a3ada3221 for my quick implementation. I just chucked the prefix meta tag checking into the collectMediaQueries method. Obviously the ugly way.