Simple, elegant and maintainable media queries in Sass
include-media is a Sass library for writing CSS media queries in an easy and maintainable way, using a natural and simplistic syntax.
As of 2.0 include-media only supports sass (dart-sass) 1.25+ and no longer supports previous implementations of sass. eg lib-sass, ruby-sass.
I spent quite some time experimenting with different libraries and mixins available out there, but eventually all of them failed to do everything I needed in an elegant way. Some of them wouldn't let me mix set breakpoints with case-specific values, others wouldn't properly handle the CSS OR operator and most of them had a syntax that I found complicated and unnatural.
include-media was the result of that experience and it includes all the features I wish I had found before, whilst maintaining a simplistic and natural syntax.
npm install include-media
yarn add include-media
bower install include-media
gem 'include_media_rails'
(maintained by KaoruDev)Finally, include the file in your project using an @import
statement.
Examples can be found here.
flex
based grid with inline-block
fallback for IE8+ compatibility.px
to em
.fit size
for the device.include-media was created by Eduardo Bouças and Kitty Giraudel. The lead maintainer is Jack McNicol.
We'll be on the lookout for your issues and pull requests — but make sure you read this before submitting any code!
This project is licensed under the terms of the MIT license.