Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

easy-media-queries

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easy-media-queries

Easy media queries

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Easy Media Queries

A node-sass importer for Whiteboard Media mixin. It allows creating breakpoints and defining styles for each breakpoint in a simple way.

Install

$ npm install --save-dev easy-media-queries

Usage

You can use this importer in node-sass or any project that depends on node-sass. the only thing you need to do to make this work is add the importer to the options and include the mixin.

node-sass

var sass = require("node-sass");
var easyMediaQueries = require("easy-media-queries");

sass.render({
  data: '@import "wb-media"; .heading { @include wb-media("<small") { display: none; }; }',
  importer: easyMediaQueries
});

grunt-sass

var easyMediaQueries = require("easy-media-queries");

grunt.initConfig({
    sass:{
        options: {
            importer: easyMediaQueries
        },
        ...        
    }
})

gulp-sass

var gulp = require("gulp");
var sass = require("gulp-sass");
var easyMediaQueries = require("easy-media-queries");

gulp.task("sass", function() {
    return gulp.src("sass/**/*.scss")
      .pipe(sass({ importer: easyMediaQueries }).on("error", sass.logError))
      .pipe(gulp.dest("./css"));
});

Examples

Adding a breakpoint

$wb-breakpoints: wb-add-breakpoint("BREAKPOINT_NAME", (
  "value"              : BREAKPOINT_VALUE
));

Using a breakpoint

// Smaller than breakpoint value
@include wb-media('<BREAKPOINT_NAME') {...}

// Larger than breakpoint value
@include wb-media('>BREAKPOINT_NAME') {...}

Simple example

@import "wb-media";

// Define breakpoints
$wb-breakpoints: wb-add-breakpoint("tablet", (
  "value"              : 768px
));
$wb-breakpoints: wb-add-breakpoint("mobile", (
  "value"              : 480px
));

// Primary title styles
.primary-title {
    display: block;
    font-size: 32px;
    
    @include wb-media('<tablet') { font-size: 24px; }
    @include wb-media('<mobile') { font-size: 16px; }
}

Keywords

FAQs

Package last updated on 05 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc