Responsive

Another central feature in web development is obviously the responsiveness of your websites. To handle that efficiently and keep a development experience nice and clean, the toolkit provide some useful mixins that you will discover here.

@sugar.media

This first mixin is kind of the main one, as well as the one that you will uses the most. See this as a simpler replacement for the traditional @media css statement. Here's an example of usage:

Ok ok... Nice but what is this mobile keyword and from where is it popping from?

This(ese) "breakpoints" comes from your theme configuration as all other settings in the toolkit. Here's a sample of media configuration:

themeMedia.config.ts

These settings gives us a "mobile first" approach and 5 breakpoints that are mobile, tablet, desktop and wide. The role of the defaultAction property will be more obvious right bellow.

Here's some more "complex" queries to explain the role of the defaultAction property:

With these examples you can see that passing from a "mobile first" approach to a "desktop first" one rely just on changing the defaultAction to <=.

@sugar.media.classes

This second mixin allows you to make some (or all) your classes responsive so you will be able to apply them directly in your HTML. With an example this will become a lot more obvious:

Consider having a some buttons with different colors like so:

This will allows you to apply responsive classes like so:

Note that for this syntax to work you need to use one of the pleasant syntax transformer.

Bugs
are not our friends...

Don't hesitate to declare an issue if something does not works as expected.

Declare my issue on Github Talk about it on Discord

The more we are,
the stronger we become.

Don't hesitate to tell some words to you friends about us. The goal is to became more and more each days to help each others...

Support us on Patreon! Share on Facebook! Make a tweet!

The more we are,
the stronger we become.

Don't be afraid to join us on Discord.

Join us on discord!

We love,
Open source!

All of our codebase can be found on Github. We hope that you may contribute to help us make our tools even better!

Discover our codebase!

Welcome on