Giter Club home page Giter Club logo

Comments (5)

hudochenkov avatar hudochenkov commented on September 16, 2024 1

It's possible in 2.0! More info https://github.com/hudochenkov/postcss-sorting/blob/master/docs/order.md

{
    order: [
        {
            type: 'at-rule',
            name: 'include',
            hasBlock: true
        }
    ]
}

from postcss-sorting.

hudochenkov avatar hudochenkov commented on September 16, 2024

You can specify mixins by their names in sort-order and place it in the end. For your example a config may looks like:

{
    "sort-order": [
        [ "@atrule" ],
        [
            "position",
            "font-size",
            "..."
        ],
        [ "@include mixin-with-content" ]
    ]
}

So mixins with the name mixin-with-content (despite they have or haven't content) will always be at the end.

from postcss-sorting.

fliptheweb avatar fliptheweb commented on September 16, 2024

@hudochenkov Yep, but it's actually looks like a workaround, because i have at least 5-10 mixins with content in each project :)

from postcss-sorting.

hudochenkov avatar hudochenkov commented on September 16, 2024

I'll look what I can do. Meanwhile, you can use a “workaround” :)

from postcss-sorting.

hudochenkov avatar hudochenkov commented on September 16, 2024

I have doubts about this feature. scss-lint has general approach to sorting. It is looking for @include, @extend and @include with inner content only. In my plugin order can be more specific:

  • @atrule — any at-rule.
  • @atrulename — any at-rule with a specific name. Ex., @media or @mixin.
  • @atrulename parameter — any at-rule with specific name and parameter. Ex., @mixin clearfix.

For example @media at-rule have inner content, too.

I have no idea how to handle every combination if I'll add option for specifiyng at-rules with content inside. Each supported at-rule handle will be doubled, because at-rule may be or may not be with content. It will be a complete madness to handle all variations and config.

from postcss-sorting.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.