Skip to content

Feature request: Non Mobile first approach switch #778

@cizza

Description

@cizza

Hi there,

thank you for your great work on Tailwind. I'm using it in my cms I'm currently developing and I've hit quite an interesting situation, for which I don't think there is a solution at the moment.

Tailwind is mobile first approach by default, which is great, however I've just switched to non-mobile mobile approach creating my screen settings in the tailwind config file like this:

screens: {
'xl': {'min': '1200px'},
'lg': {'max': '1199px'},
'md': {'max': '991px'},
'sm': {'max': '767px'},
'xs': {'max': '576px'}
}

and when I need, I simply use the @Responsive directive to generate any required styles.

The problem I'm facing is the order the styles are getting generated, for example:

@Responsive {
.mr-10px { margin-right: 10px; }
}

generates the responsive classes in correct order but the non responsive class is generated underneath the responsive ones, and therefore overriding the responsive classes. That's quite a problem.

What I propose is a property in the custom tailwind config file:

mobileFirst: true [true/false] - true by default

which would allow the user to switch the mobile first off, in which case the non responsive class would get generated above the responsive classes.

I think it makes sense, because in the config file, we can actually control the order in which the responsive classes are generated, but we can't select to generate the non-responsive class above or below the rest.

If I may ask for anyone responding to this thread, please refrain from proposing to use mobile first approach or to disapprove a validity of non mobile first approach.

Thank you all!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions