sassnode-sassrtlcss

SASS: preserve comment position


I recently decided to use RTLCSS to make RTL versions of my stylesheetes. Now i'm trying to use Declaration-level directives to tell RTLCSS what to do, but SASS compiles my comments to next line.

For example, font-size: 14px/*rtl:15px*/; Compiles to

font-size: 14px;
/*rtl:15px*/

And that stops RTLCSS from procssing it properly. Is there a way around this? can i configure sass to just compile the value as-is, preserving comment position?

P.S. I use grunt-sass(node-sass) to process my scss files.


Solution

  • Use SASS interpolation syntax, passing your comment as string

    body{ font-size: 14px #{"/*rtl:15px*/"}; }
    

    will produce

    body { font-size: 14px /*rtl:15px*/; }