Why does Magento LESS compiling re-order my codeMagento Less not compilingWhy does Magento 2 use PHP to...

Achieving MPPT of a solar panel with LM2596

Where is the line between being obedient and getting bullied by a boss?

Practical reasons to have both a large police force and bounty hunting network?

I encountered my boss during an on-site interview at another company. Should I bring it up when seeing him next time?

Is it possible to convert a suspension fork to rigid by drilling it?

How can I be pwned if I'm not registered on the compromised site?

How do I deal with being jealous of my own players?

Why do phishing e-mails use faked e-mail addresses instead of the real one?

What is the difference between a forward slip and a side slip?

If nine coins are tossed, what is the probability that the number of heads is even?

Where is the fallacy here?

Rationale to prefer local variables over instance variables?

What type of investment is best suited for a 1-year investment on a down payment?

Are there any other Chaos-worshipping races?

Why is it "take a leak?"

Toast materialize

It took me a lot of time to make this, pls like. (YouTube Comments #1)

How can I handle a player who pre-plans arguments about my rulings on RAW?

Reason why dimensional travelling would be restricted

Why are special aircraft used for the carriers in the United States Navy?

Is divide-by-zero a security vulnerability?

Can we carry rice to Japan?

How to substitute values from a list into a function?

In Adventurer's League, is it possible to keep the Ring of Winter if you manage to acquire it in the Tomb of Annihilation adventure?



Why does Magento LESS compiling re-order my code


Magento Less not compilingWhy does Magento 2 use PHP to compile less files?Magento 2 How to update existing less file?How does Magento 2 work with CSS grunt-autoprefixerMagento-2.2 development with CSS only (no use of LESS)magento 2 enterprice client side less compilationMagento 2.2 LESS not compiling locally on Ubuntumagento 2 crash after set to Client side less compilationAdd a static block right under the main navigation, not wrapped in a widget, full widthGrunt compile of LESS fails with Error compiling lib/web/css/docs/source/docs.less













0















I have been trying to create a basic grid for my theme. Here's the code



.row {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
margin-right: -20px;
margin-left: -20px;

&,
> .col {
box-sizing: border-box;
}

&.align-items-center {
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}


> .col {
position: relative;
width: 100%;
min-height: 1px;
padding-right: 20px;
padding-left: 20px;
}

> .col-full {
-webkit-box-flex: 0;
-ms-flex: 0 0 100%;
flex: 0 0 100%;
max-width: 100%;
}

> .col-half {
-webkit-box-flex: 0;
-ms-flex: 0 0 50%;
flex: 0 0 50%;
max-width: 50%;
}

> .col-third {
-webkit-box-flex: 0;
-ms-flex: 0 0 33.333333%;
flex: 0 0 33.333333%;
max-width: 33.333333%;
}

> .col-two-third {
-webkit-box-flex: 0;
-ms-flex: 0 0 66.66666%;
flex: 0 0 66.66666%;
max-width: 66.66666%;
}

> .col-quater {
-webkit-box-flex: 0;
-ms-flex: 0 0 25%;
flex: 0 0 25%;
max-width: 25%;
}
}

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__s) {
.row {
> .col-s-full {
-webkit-box-flex: 0;
-ms-flex: 0 0 100%;
flex: 0 0 100%;
max-width: 100%;
}
> .col-s-half {
-webkit-box-flex: 0;
-ms-flex: 0 0 50%;
flex: 0 0 50%;
max-width: 50%;
}
> .col-s-third {
-webkit-box-flex: 0;
-ms-flex: 0 0 33.333333%;
flex: 0 0 33.333333%;
max-width: 33.333333%;
}
> .col-s-two-third {
-webkit-box-flex: 0;
-ms-flex: 0 0 66.66666%;
flex: 0 0 66.66666%;
max-width: 66.66666%;
}
> .col-s-quater {
-webkit-box-flex: 0;
-ms-flex: 0 0 25%;
flex: 0 0 25%;
max-width: 25%;
}
}
}

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
.row {
> .col-m-full {
-webkit-box-flex: 0;
-ms-flex: 0 0 100%;
flex: 0 0 100%;
max-width: 100%;
}
> .col-m-half {
-webkit-box-flex: 0;
-ms-flex: 0 0 50%;
flex: 0 0 50%;
max-width: 50%;
}
> .col-m-third {
-webkit-box-flex: 0;
-ms-flex: 0 0 33.333333%;
flex: 0 0 33.333333%;
max-width: 33.333333%;
}
> .col-m-two-third {
-webkit-box-flex: 0;
-ms-flex: 0 0 66.66666%;
flex: 0 0 66.66666%;
max-width: 66.66666%;
}
> .col-m-quater {
-webkit-box-flex: 0;
-ms-flex: 0 0 25%;
flex: 0 0 25%;
max-width: 25%;
}
}
}
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__l) {
.row {
> .col-l-full {
-webkit-box-flex: 0;
-ms-flex: 0 0 100%;
flex: 0 0 100%;
max-width: 100%;
}
> .col-l-half {
-webkit-box-flex: 0;
-ms-flex: 0 0 50%;
flex: 0 0 50%;
max-width: 50%;
}
> .col-l-third {
-webkit-box-flex: 0;
-ms-flex: 0 0 33.333333%;
flex: 0 0 33.333333%;
max-width: 33.333333%;
}
> .col-l-two-third {
-webkit-box-flex: 0;
-ms-flex: 0 0 66.66666%;
flex: 0 0 66.66666%;
max-width: 66.66666%;
}
> .col-l-quater {
-webkit-box-flex: 0;
-ms-flex: 0 0 25%;
flex: 0 0 25%;
max-width: 25%;
}
}
}


But if I try to add the classes col col-half col-m-quater to an element in the grid it does not work as intended.



So I looked into the CSS and when the code is compiled the breakpoints are being added before the normal classes. So the class col-half is much further down the file than the class col-m-half so that is always getting over-ridden by the col-half class.



My question is, why is my breakpoint code being placed above the class not in breakpoints.



And how much benefit is there to using Magento's .media-width() over the standard @media query









share



























    0















    I have been trying to create a basic grid for my theme. Here's the code



    .row {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    margin-right: -20px;
    margin-left: -20px;

    &,
    > .col {
    box-sizing: border-box;
    }

    &.align-items-center {
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    }


    > .col {
    position: relative;
    width: 100%;
    min-height: 1px;
    padding-right: 20px;
    padding-left: 20px;
    }

    > .col-full {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 100%;
    flex: 0 0 100%;
    max-width: 100%;
    }

    > .col-half {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 50%;
    flex: 0 0 50%;
    max-width: 50%;
    }

    > .col-third {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 33.333333%;
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
    }

    > .col-two-third {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 66.66666%;
    flex: 0 0 66.66666%;
    max-width: 66.66666%;
    }

    > .col-quater {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 25%;
    flex: 0 0 25%;
    max-width: 25%;
    }
    }

    .media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__s) {
    .row {
    > .col-s-full {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 100%;
    flex: 0 0 100%;
    max-width: 100%;
    }
    > .col-s-half {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 50%;
    flex: 0 0 50%;
    max-width: 50%;
    }
    > .col-s-third {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 33.333333%;
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
    }
    > .col-s-two-third {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 66.66666%;
    flex: 0 0 66.66666%;
    max-width: 66.66666%;
    }
    > .col-s-quater {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 25%;
    flex: 0 0 25%;
    max-width: 25%;
    }
    }
    }

    .media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
    .row {
    > .col-m-full {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 100%;
    flex: 0 0 100%;
    max-width: 100%;
    }
    > .col-m-half {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 50%;
    flex: 0 0 50%;
    max-width: 50%;
    }
    > .col-m-third {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 33.333333%;
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
    }
    > .col-m-two-third {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 66.66666%;
    flex: 0 0 66.66666%;
    max-width: 66.66666%;
    }
    > .col-m-quater {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 25%;
    flex: 0 0 25%;
    max-width: 25%;
    }
    }
    }
    .media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__l) {
    .row {
    > .col-l-full {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 100%;
    flex: 0 0 100%;
    max-width: 100%;
    }
    > .col-l-half {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 50%;
    flex: 0 0 50%;
    max-width: 50%;
    }
    > .col-l-third {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 33.333333%;
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
    }
    > .col-l-two-third {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 66.66666%;
    flex: 0 0 66.66666%;
    max-width: 66.66666%;
    }
    > .col-l-quater {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 25%;
    flex: 0 0 25%;
    max-width: 25%;
    }
    }
    }


    But if I try to add the classes col col-half col-m-quater to an element in the grid it does not work as intended.



    So I looked into the CSS and when the code is compiled the breakpoints are being added before the normal classes. So the class col-half is much further down the file than the class col-m-half so that is always getting over-ridden by the col-half class.



    My question is, why is my breakpoint code being placed above the class not in breakpoints.



    And how much benefit is there to using Magento's .media-width() over the standard @media query









    share

























      0












      0








      0








      I have been trying to create a basic grid for my theme. Here's the code



      .row {
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      -ms-flex-wrap: wrap;
      flex-wrap: wrap;
      margin-right: -20px;
      margin-left: -20px;

      &,
      > .col {
      box-sizing: border-box;
      }

      &.align-items-center {
      -webkit-box-align: center;
      -ms-flex-align: center;
      align-items: center;
      }


      > .col {
      position: relative;
      width: 100%;
      min-height: 1px;
      padding-right: 20px;
      padding-left: 20px;
      }

      > .col-full {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 100%;
      flex: 0 0 100%;
      max-width: 100%;
      }

      > .col-half {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 50%;
      flex: 0 0 50%;
      max-width: 50%;
      }

      > .col-third {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 33.333333%;
      flex: 0 0 33.333333%;
      max-width: 33.333333%;
      }

      > .col-two-third {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 66.66666%;
      flex: 0 0 66.66666%;
      max-width: 66.66666%;
      }

      > .col-quater {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 25%;
      flex: 0 0 25%;
      max-width: 25%;
      }
      }

      .media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__s) {
      .row {
      > .col-s-full {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 100%;
      flex: 0 0 100%;
      max-width: 100%;
      }
      > .col-s-half {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 50%;
      flex: 0 0 50%;
      max-width: 50%;
      }
      > .col-s-third {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 33.333333%;
      flex: 0 0 33.333333%;
      max-width: 33.333333%;
      }
      > .col-s-two-third {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 66.66666%;
      flex: 0 0 66.66666%;
      max-width: 66.66666%;
      }
      > .col-s-quater {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 25%;
      flex: 0 0 25%;
      max-width: 25%;
      }
      }
      }

      .media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
      .row {
      > .col-m-full {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 100%;
      flex: 0 0 100%;
      max-width: 100%;
      }
      > .col-m-half {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 50%;
      flex: 0 0 50%;
      max-width: 50%;
      }
      > .col-m-third {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 33.333333%;
      flex: 0 0 33.333333%;
      max-width: 33.333333%;
      }
      > .col-m-two-third {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 66.66666%;
      flex: 0 0 66.66666%;
      max-width: 66.66666%;
      }
      > .col-m-quater {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 25%;
      flex: 0 0 25%;
      max-width: 25%;
      }
      }
      }
      .media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__l) {
      .row {
      > .col-l-full {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 100%;
      flex: 0 0 100%;
      max-width: 100%;
      }
      > .col-l-half {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 50%;
      flex: 0 0 50%;
      max-width: 50%;
      }
      > .col-l-third {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 33.333333%;
      flex: 0 0 33.333333%;
      max-width: 33.333333%;
      }
      > .col-l-two-third {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 66.66666%;
      flex: 0 0 66.66666%;
      max-width: 66.66666%;
      }
      > .col-l-quater {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 25%;
      flex: 0 0 25%;
      max-width: 25%;
      }
      }
      }


      But if I try to add the classes col col-half col-m-quater to an element in the grid it does not work as intended.



      So I looked into the CSS and when the code is compiled the breakpoints are being added before the normal classes. So the class col-half is much further down the file than the class col-m-half so that is always getting over-ridden by the col-half class.



      My question is, why is my breakpoint code being placed above the class not in breakpoints.



      And how much benefit is there to using Magento's .media-width() over the standard @media query









      share














      I have been trying to create a basic grid for my theme. Here's the code



      .row {
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      -ms-flex-wrap: wrap;
      flex-wrap: wrap;
      margin-right: -20px;
      margin-left: -20px;

      &,
      > .col {
      box-sizing: border-box;
      }

      &.align-items-center {
      -webkit-box-align: center;
      -ms-flex-align: center;
      align-items: center;
      }


      > .col {
      position: relative;
      width: 100%;
      min-height: 1px;
      padding-right: 20px;
      padding-left: 20px;
      }

      > .col-full {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 100%;
      flex: 0 0 100%;
      max-width: 100%;
      }

      > .col-half {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 50%;
      flex: 0 0 50%;
      max-width: 50%;
      }

      > .col-third {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 33.333333%;
      flex: 0 0 33.333333%;
      max-width: 33.333333%;
      }

      > .col-two-third {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 66.66666%;
      flex: 0 0 66.66666%;
      max-width: 66.66666%;
      }

      > .col-quater {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 25%;
      flex: 0 0 25%;
      max-width: 25%;
      }
      }

      .media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__s) {
      .row {
      > .col-s-full {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 100%;
      flex: 0 0 100%;
      max-width: 100%;
      }
      > .col-s-half {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 50%;
      flex: 0 0 50%;
      max-width: 50%;
      }
      > .col-s-third {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 33.333333%;
      flex: 0 0 33.333333%;
      max-width: 33.333333%;
      }
      > .col-s-two-third {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 66.66666%;
      flex: 0 0 66.66666%;
      max-width: 66.66666%;
      }
      > .col-s-quater {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 25%;
      flex: 0 0 25%;
      max-width: 25%;
      }
      }
      }

      .media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
      .row {
      > .col-m-full {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 100%;
      flex: 0 0 100%;
      max-width: 100%;
      }
      > .col-m-half {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 50%;
      flex: 0 0 50%;
      max-width: 50%;
      }
      > .col-m-third {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 33.333333%;
      flex: 0 0 33.333333%;
      max-width: 33.333333%;
      }
      > .col-m-two-third {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 66.66666%;
      flex: 0 0 66.66666%;
      max-width: 66.66666%;
      }
      > .col-m-quater {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 25%;
      flex: 0 0 25%;
      max-width: 25%;
      }
      }
      }
      .media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__l) {
      .row {
      > .col-l-full {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 100%;
      flex: 0 0 100%;
      max-width: 100%;
      }
      > .col-l-half {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 50%;
      flex: 0 0 50%;
      max-width: 50%;
      }
      > .col-l-third {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 33.333333%;
      flex: 0 0 33.333333%;
      max-width: 33.333333%;
      }
      > .col-l-two-third {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 66.66666%;
      flex: 0 0 66.66666%;
      max-width: 66.66666%;
      }
      > .col-l-quater {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 25%;
      flex: 0 0 25%;
      max-width: 25%;
      }
      }
      }


      But if I try to add the classes col col-half col-m-quater to an element in the grid it does not work as intended.



      So I looked into the CSS and when the code is compiled the breakpoints are being added before the normal classes. So the class col-half is much further down the file than the class col-m-half so that is always getting over-ridden by the col-half class.



      My question is, why is my breakpoint code being placed above the class not in breakpoints.



      And how much benefit is there to using Magento's .media-width() over the standard @media query







      magento2 frontend styles less-compilation





      share












      share










      share



      share










      asked 7 mins ago









      CallumCallum

      1144




      1144






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "479"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f264589%2fwhy-does-magento-less-compiling-re-order-my-code%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f264589%2fwhy-does-magento-less-compiling-re-order-my-code%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

          How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

          變成蝙蝠會怎樣? 參考資料 外部連結 导航菜单Thomas Nagel, "What is it like to be a...