Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Sass Function Return a Comment?

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #42733
    ksmith
    Member

    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)
  • The forum ‘CSS’ is closed to new topics and replies.