/boobreaks

Use Bootstraps breakpoints inside your JavaScript!

Primary LanguageTypeScriptMIT LicenseMIT

Boobreaks 📏

Demo

A simple and small (881 bytes) utility to make Bootstraps breakpoints available in your JavaScript files.

Tested with Bootstrap version: 4.3.1

Installation

npm install boobreaks

How to use

UMD

Load the library:

<!-- <head> -->
<link rel="stylesheet" href="./path/to/boobreaks.umd.css" />
<script defer src="./path/to/boobreaks.umd.js"></script>
<!-- </head> -->

Use it:

console.log(`Breakpoint is at`, Boobreaks.current(), Boobreaks.width())

CommonJS

import 'boobreaks/dist/boobreaks.css'
import { current, width } from 'boobreaks'

console.log(`Breakpoint is at`, current(), width())

Available functions

Function Params Return Description
current() none string Current breakpoint alias.
width() none number Current screen width by alias.
is() expression string If the current screen matches the expression, e.g.: >=sm