Grow your CSS skills. Land your dream job.

Sass Function Return a Comment?

  • # February 14, 2013 at 1:35 pm

    Anyone know if it is possible to return a comment in a function and have it compile it into the CSS?

    @function em($target, $context: $base-font-size)
    @if $target == 0
    @return 0
    @return $target / $context + 0em /* #{$target} / #{$context} */

    Used like this

    $base-font-size: 16px
    selector
    font-size: em(20px)

    Ideally that would compile to this

    .selector {
    font-size: 1.25em; /* 20px / 16px */
    }

    I use compass and have tried /*! comment here */ but that only seems to work at the top of the document. This is just like a nice to have. Once a project leaves my desk the CSS is typically used and my sass is tossed. Crazy to me but whatever.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".