eqcss / eqcss

EQCSS is a CSS Reprocessor that introduces Element Queries, Scoped CSS, a Parent selector, and responsive JavaScript to all browsers IE8 and up

Home Page:https://elementqueries.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SCSS and eval() units

matthewjumpsoffbuildings opened this issue · comments

using the eval('someJS')px form doesnt work in SCSS - it seems to output eval('someJS') px with a space after the eval()

its not a major issue, since i can still do eval('someJS+"px"') but the other format is much cleaner/simpler to read. any thoughts on how to get around this?

Hi @matthewjumpsoffbuildings! There's a little snippet in https://github.com/eqcss/eqcss/wiki/Using-EQCSS-with-CSS-Preprocessors about using a mixin to quote raw EQCSS syntax inside SCSS and have the compiler ignore it and pass it through unchanged to the CSS code it outputs.

To me, doing extra work to quote EQCSS in SCSS seems like doing two things extra if the goal is just to end up with untouched EQCSS after your build step, compared to the idea of excluding just your EQCSS styles from the rest of your CSS being processed by SCSS and including that exactly as written. At the end of the article I linked to above I explain how you can load EQCSS-powered styles outside of the other CSS files if that saves some work. EQCSS is like a reprocessor so it's a little different than a preprocessor in that all the special syntax is supposed to stay in, and only gets transformed into CSS after the page has loaded :)