• Stars
    star
    169
  • Rank 224,453 (Top 5 %)
  • Language
    Ruby
  • License
    MIT License
  • Created about 12 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Sass::MediaQueryCombiner

Gem Version Build Status Coverage Status Code Climate

Combines all matching media queries while compiling your Sass.

If you're using Rails 3.1+ or Sprockets, you should use sprockets-media_query_combiner.

For node pipelines try node-css-mqpacker.

For example:

h3 {
  color: orange
}
@media (max-width: 480px) {
  h1 {
    color: red
  }
}
@media (max-width: 980px) {
  h4 {
    color: black
  }
}
@media (max-width: 480px) {
  h2 {
    color: blue
  }
}

Would end up as (except the whitespace won't be so clean):

h3 {
  color: orange
}
@media (max-width: 480px) {
  h1 {
    color: red
  }
  h2 {
    color: blue
  }
}
@media (max-width: 980px) {
  h4 {
    color: black
  }
}

Note

This will change the order of your css, so be aware of that. All the @media queries will end up at the end of each css file in the order that they are first encountered. In other words, if you're relying on only using min-width or only using max-width in a specific order you'll want to be sure define your media queries in the right order up front before you use them randomly throughout your file.

Installation

Requires Ruby >= 1.9.2.

Add this line to your application's Gemfile:

gem 'sass-media_query_combiner'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sass-media_query_combiner

Usage

In your config.rb

require 'sass-media_query_combiner'

If you're using sass --watch do:

sass --watch -r sass-media_query_combiner

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Bitdeli Badge

More Repositories

1

software-development

Notes and articles on software development. All content is original. Most of the content reflects the way that our current software team operates.
138
star
2

eslintd-fix

Emacs minor-mode to automatically fix javascript with eslint_d.
Emacs Lisp
64
star
3

sprockets-media_query_combiner

Ruby
41
star
4

mergeq

Get your CI (like TeamCity) to merge after builds pass with a queue of gated merges.
Shell
40
star
5

night-owl-emacs

Night Owl Theme for Emacs
Emacs Lisp
37
star
6

company-flow

Emacs Lisp
33
star
7

flycheck-credo

Emacs Lisp
20
star
8

emacs-modern-tab-bar

Emacs Lisp
13
star
9

message-db-viewer

JavaScript
12
star
10

vim-sass-status

Vim Script
11
star
11

compete

JavaScript
10
star
12

guard-zeus_server

Ruby
9
star
13

emacs-popup-mode

Emacs Lisp
9
star
14

emacs-orgonomic

Emacs Lisp
8
star
15

compete.rock_paper_scissors_pro

C#
7
star
16

flycheck-dialyxir

Emacs Lisp
5
star
17

splits

JavaScript
4
star
18

advanced-caching-vulnerability

Ruby
3
star
19

nservicebus.objectbuilder.ninject

C#
2
star
20

hyperion

Ruby
2
star
21

experiment

JavaScript
2
star
22

flycheck-dogma

Emacs Lisp
2
star
23

atom-painless-panes

CoffeeScript
2
star
24

media_query_test

2
star
25

git-lead-time

Ruby
2
star
26

ripgrep-capf

Emacs Lisp
1
star
27

cassini-runner

Command line only version of cassini
C#
1
star
28

lsp-auto-rename-repro

Emacs Lisp
1
star
29

keymandofiles

Ruby
1
star
30

eslint-plugin-no-require-lodash

JavaScript
1
star
31

type-create-element

JavaScript
1
star
32

phoenix-webpack2-react-example

Elixir
1
star
33

consult-git-commit

Emacs Lisp
1
star
34

emacs-lookup

Emacs Lisp
1
star
35

contextual-menubar

Emacs package that displays the menubar if on a graphical display, but hides it if in a terminal.
Emacs Lisp
1
star
36

lsp-completion-repro

TypeScript
1
star
37

undefined_example

example of https://github.com/thoughtbot/capybara-webkit/issues/327
Ruby
1
star
38

private-development-gem-warning-repro

Ruby
1
star
39

figwheel-plus-vim-fireplace

Clojure
1
star
40

evt-actioncable-server

Ruby
1
star