Add this to your Sass (functions) file. It is recommended that you keep a separate functions.scss file and @import 'functions';
at the top of your main/global css file. This way it keeps things organized. OR you could just add this function to the top of your main scss file.
1@function pem($pixels) {
2 @return #{$pixels/16.0}em
3}
Using scss syntax:
1@media (min-width: pem(768)) {
2 ...
3}
When compiled to plain CSS and sent to the browser, we get:
1@media (min-width: 48em) {
2 ...
3}