A simple and small (881 bytes) utility to make Bootstraps breakpoints available in your JavaScript files.
Tested with Bootstrap version: 4.3.1
npm install boobreaks
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())
import 'boobreaks/dist/boobreaks.css'
import { current, width } from 'boobreaks'
console.log(`Breakpoint is at`, current(), width())
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 |