You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP

css-mqpacker-starter

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
c

css-mqpacker-starter

Mixin starter for css-mqpacker with bootstrap breakpoints. Scss mixin for right order of queries

1.0.1
latest
77

Supply Chain Security

100

Vulnerability

99

Quality

96

Maintenance

100

License

Repository has been archived by the owner.

Deprecated

Maintenance

The maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.

Found 1 instance in 1 package

Unpopular package

Quality

This package is not very popular.

Found 1 instance in 1 package

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Issues
0

css-mqpacker-starter

Mixin starter with scss for css-mqpacker

You must use the package with scss and postcss. You will find the webpack rule for compiling scss files with css-mqpacker below or use webpack starter.

Installation
Breakpoints
Init order
Mixins
Source mixin code
Possible order error
Webpack rule for compiling

Installation

Install the package

npm i css-mqpacker-starter

Import in main scss file

@import "~css-mqpacker-starter";
@include initMediaPosition();

Now use it :)

@include sm {
  body {
    font-size: 15px;
  }
}

Breakpoints

The package provide default breakpoints:

BreakpointPixels
$xl1200px
$lg992px
$md768px
$sm576px
$xs420px
$xxs360px

Mixins

There are media queries mixins for each breakpoint. Desktop First and Mobile First.

@include xl {
}
@include xl-up {
}
downup
xlxl-up
lglg-up
mdmd-up
smsm-up
xsxs-up
xxsxxs-up

Init order:

Put the mixin before custom scss code. It will create placeholder styles for body tag. It's important for css-mqpacker; There can be wrong order media queries without the mixin.

@include initMediaPosition();

Possible error see below

Source mixin code:

@mixin xl {
  @media only screen and (max-width: $xl - 1) {
    @content;
  }
}

@mixin xl-up {
  @media only screen and (min-width: $xl) {
    @content;
  }
}

Possible order error

In the case:

.card {
  // styles
  @include sm {
    // styles 2
  }
}

.container {
  max-width: 1200px;
  @include md {
    max-width: 500px;
  }
  @include sm {
    max-width: none;
  }
}

Output after css-mqpacker will be:

.card {
  // styles
}
.container {
  max-width: 1200px;
}

@media only screen and (min-width: $sm) {
  .card {
    // styles 2
  }
  .container {
    max-width: none;
  }
}
@media only screen and (min-width: $md) {
  .container {
    max-width: 500px;
  }
}

On screen $sm and below style .container{ max-width: none; } will not be applied. Use @include initMediaPosition() to prevent this error.

Webpack rule for compiling

Here is example: Webpack starter

// rules:
[
  {
    test: /\.scss$/,
    use: [
      isDev ? "style-loader" : MiniCssExtractPlugin.loader,
      {
        loader: "css-loader",
        options: { sourceMap: true },
      },
      {
        loader: "postcss-loader",
        options: {
          sourceMap: true,
          config: { path: "postcss.config.js" },
        },
      },
      {
        loader: "sass-loader",
        options: { sourceMap: true },
      },
    ],
  },
];

FAQs

Package last updated on 07 Jun 2020

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