npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

asperjs

v1.0.1

Published

Formerly known as Easy-Query, an easy to use, easy to customize sheet of SCSS media queries tailored for use alongside or without popular frameworks such as Bootstrap and Foundation.

Downloads

27

Readme

AsperJS - Easy Media Query Generator

Formerly EasyQueryJS

Installation

npm install asperjs --save-dev

or

git clone https://github.com/Aetiranos/AsperJS.git

Usage

AsperJS can be instantiated and used in a variety of ways. In it's non- parameterized form, it simply uses default values to generate your media query stylesheets. However, the other instantiation methods allow for more control over what is generated.

Default Values

{
    lang: 'scss',
    framework: 'bootstrap3',
    breakpoints: null // Loaded from 'bootstrap3' framework,
    buildCSS: true
}

Developers can be creative when it comes to how and where they use frame- works like this; however, it's intended use is with build pipelines such as Gulp or Grunt. See below for an example of usage with Gulp.

Non-Parameterized Use

require('asperjs')();

Framework Instantiation

When instantiating AsperJS, you may choose to pass the name of a supported framework as a parameter. If you do, it will autoload the prespecified media query breakpoints from that framework. See below for a list of supported frameworks.

require('asperjs')('foundation5')

Breakpoint Instantiation

To generate your own breakpoints without having to rely on a third-party framework's definitions, simply pass an array of breakpoints. These breakpoints can be numbers or strings. If you pass numbers, they will be treated as REM units by default; however, if you pass strings, they must be properly formatted as pixel, point, EM, or REM sizes with the unit of measurement included.

require('asperjs')([20, 40, 75])

or

require('asperjs')(['768px', '972px', '1200px']);

Object Parameter Instantiation

require('asperjs')({
    lang: 'scss',
    breakpoints: [20, 40, 75],
    buildCSS: true
})

###Breakpoint Variables

When passing your own custom array of breakpoints, the breakpoint variable names will depend on how many elements are in the array. The following table describes each media query variable you can you use in your SCSS code.

| 1 Breakpoint | 2 | 3 | 4 | 5 | |:---:|:---:|:---:|:---:|:---:| | $sm-only | $sm-only | $xs-only | $xs-only | $xs-only | | $lg-only | $md-only | $sm-only | $sm-only | $sm-only | | | $lg-only | $md-only | $md-only | $md-only | | | $md-up | $lg-only | $lg-only | $lg-only | | | $md-down | $sm-up | $xl-only | $xl-only | | | | $sm-down | $sm-up | $xx-only | | | | $md-up | $sm-down | $sm-up | | | | $md-down | $md-up | $sm-down | | | | | $md-down | $md-up | | | | | $lg-up | $md-down | | | | | $lg-down | $lg-up | | | | | | $lg-down | | | | | | $xl-up | | | | | | $xl-down |

An Example Use of AsperJS with Gulp

require('asperjs')({lang: 'scss'});
 var gulp = require('gulp'),
     sass = require('gulp-sass');
 
 gulp.task('default', function() {
     gulp.src([ './app.scss' ])
     .pipe(sass())
     .pipe(gulp.dest('./'));
 });

Supported Frameworks

  • Bootstrap2 (as 'bootstrap2')
  • Bootstrap3 (as 'bootstrap3')
  • Bootstrap4 (as 'bootstrap4')
  • Foundation5 (as 'foundation5')
  • Foundation6 for Sites (as 'foundation6forsites')
  • Foundation6 for Apps (as 'foundation6forapps')
  • Foundation6 for Email (as 'foundation6foremail')
  • Skeleton2 (as 'skeleton2')
  • OpenFramework (as 'openframework')

Supported Languages

  • LessCSS (as 'less')
  • SASS (as 'sass')
  • SCSS (as 'scss')

###Breakpoint Classes As of 1.1.5, EasyQuery also produces a set of classes that mock your breakpoint variables so as to easily manipulate display or hide DOM elements with them without being forced to hardcode anything in SCSS. The generally work the same as Bootstrap's built-in grid variables (.hidden-xs, .visible-xs) just a lot less verbose.

<div class="sm-down">
    This will only appear on resolutions within the range of $sm-range and smaller.
    It will be hidden on all resolutions of $md-up.
</div>

It is the exact same as writing the below class definition in your SCSS file manually. It is what is generated for you automatically for use with these classes.

.sm-down {
    @media #{$md-up} {
        display: none;
    }
}

###Contributing

Anyone who is interested in contributing and building this project up, you're encouraged to do so! Collaboration is welcome!

If you find any bugs or issues with the source code, be sure to submit an issue or submit a pull request with a fix.

If you have a feature request, submit an issue ticket (particularly if this is a major request).

For smaller requests, feel free to submit a pull request with the requested feature code.