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

Home Forums CSS Tips for converting LESS mixins to SCSS? Anyone?

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #173299

    I’m working on replatforming one the sites I work to an environment that uses SCSS (the current site uses LESS).

    Converting the LESS to SCSS has been pretty straight forward, but I’m stuck on how to properly convert a LESS mixing like:

    .verticalGradient4(@startColor: #fff, @midColor: #fff, @colorStop: 50%, @midColor2: #fff, @colorStop2: 50%, @endColor: #fff, @img: none) {
    background: @img @endColor; // Old browsers
    background: -moz-linear-gradient(@startColor 0, @midColor @colorStop, @midColor2 @colorStop2, @endColor); // FF 3.6+
    background: -ms-linear-gradient(@startColor, @midColor @colorStop, @midColor2 @colorStop2, @endColor); // IE10
    background: -o-linear-gradient(@startColor, @midColor @colorStop, @midColor2 @colorStop2, @endColor); // Opera 11.10
    background: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), color-stop(@colorStop, @midColor), color-stop(@colorStop2, @midColor2), to(@endColor)); // Safari 4+, Chrome 2+
    background: -webkit-linear-gradient(@startColor, @midColor @colorStop, @midColor2 @colorStop2, @endColor); // Safari 5.1+, Chrome 10+
    background: linear-gradient(@startColor, @midColor @colorStop, @midColor2 @colorStop2, @endColor); // W3C
    filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)", @startColor, @endColor)); // IE9 and down

    What is throwing me off is how the variables are defined at the top. Not sure how to best to this with SCSS


    Great find! Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.