PHPackages                             apancutt/bsutils - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. apancutt/bsutils

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

apancutt/bsutils
================

JavaScript utilities for use with Twitter Bootstrap.

v0.0.2(10y ago)05.1k↓100%MITJavaScript

Since Nov 28Pushed 10y ago1 watchersCompare

[ Source](https://github.com/apancutt/bsutils)[ Packagist](https://packagist.org/packages/apancutt/bsutils)[ Docs](http://github.com/apancutt/bsutils)[ RSS](/packages/apancutt-bsutils/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

bsutils
=======

[](#bsutils)

JavaScript utilities for use with [Twitter Bootstrap](http://getbootstrap.com).

Requirements
------------

[](#requirements)

- Twitter Bootstrap 3.0+

Installation
------------

[](#installation)

Ensure `bsutils-core.min.js` is included at the bottom of your page then initalize a new `BsUtils` instance:

```

        (function() {

            var bsutils = new BsUtils();
            // ...

        }) ();

```

Modules
-------

[](#modules)

Out-of-the-box, `bsutils` doesn't do much. The juice comes from modules. You'll need to manually include the module(s) you required into your page in order to use them.

```

    (function() {

        var bsutils = new BsUtils({
            mymodule_options = {}
        });

        var mymodule = bsutils.module("mymodule"); // Will be initialized with mymodule_options

        // ...

    }) ();

```

### `version` Detect Bootstrap CSS version

[](#version-detect-bootstrap-css-version)

Support for this functionality is currently not provided by Bootstrap so you will need to compile your own Bootstrap LESS/SASS files for it to work.

##### LESS Installation

[](#less-installation)

In `variables.less` add:

```
@version: "3.3.1"; // Replace with the version that you are using

```

In `utilities.less` add:

```
.bootstrap-version {
  &:extend(.hidden);
  &:after {
    content: $version
  }
}

```

##### SCSS Installation

[](#scss-installation)

In `_variables.scss` add:

```
$version: "3.3.1"; // Replace with the version that you are using

```

In `_utilities.scss` add:

```
.bootstrap-version {
  @extend .hidden;
  &:after {
    content: $version
  }
}

```

##### Options

[](#options)

  Name Type Default Description   `container` `HTMLElement` `document.body` Container for generated version sniffer element.   `tag` `string` `DIV` HTML element tag for generated version sniffer element. ##### Methods

[](#methods)

  `get()` `string` Returns the Twitter Bootstrap version. ##### Examples

[](#examples)

```
var bsutils = new BsUtils();

// Get the Bootstrap version (e.g. "3.3.1")
console.log(bsutils.module("version").get());

```

### `viewport` Detect the active viewport

[](#viewport-detect-the-active-viewport)

##### Options

[](#options-1)

  Name Type Default Description   `container` `HTMLElement` `document.body` Container for generated viewport sniffer elements.   `tag` `string` `DIV` HTML element tag for generated viewport sniffer elements. ##### Methods

[](#methods-1)

  `all()` `array` Returns all known viewports.   `get()` `string` Returns the current viewport.   `is(string viewport)` `boolean` Returns `true` if current viewport matches `viewport`.   `lt(string viewport)` `boolean` Returns `true` if current viewport is less than `viewport`.   `lte(string viewport)` `boolean` Returns `true` if current viewport is less than or equal to `viewport`.   `gt(string viewport)` `boolean` Returns `true` if current viewport is greater than `viewport`.   `gte(string viewport)` `boolean` Returns `true` if current viewport is greater than or equal to `viewport`. ##### Examples

[](#examples-1)

```
var bsutils = new BsUtils();

// Get the current viewport (e.g. "xs", "md", etc.)
console.log(bsutils.module("viewport").get());

// Test the current viewport
console.log(bsutils.module("viewport").is("xs")); // TRUE only if current viewport is "xs"
console.log(bsutils.module("viewport").lt("md")); // TRUE only if current viewport is "xs" or "sm"
console.log(bsutils.module("viewport").lte("md")); // TRUE only if current viewport is "xs" or "sm" or "md"
console.log(bsutils.module("viewport").gt("md")); // TRUE only if current viewport is "lg"
console.log(bsutils.module("viewport").gte("md")); // TRUE only if current viewport is "lg" or "md"

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~335 days

Total

2

Last Release

3852d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a4f0dde89f4a80fb5b2eada56c62198b1d32dcc03deca08502556e02ce2396bb?d=identicon)[apancutt](/maintainers/apancutt)

---

Top Contributors

[![apancutt](https://avatars.githubusercontent.com/u/1040525?v=4)](https://github.com/apancutt "apancutt (8 commits)")

---

Tags

JSbootstrap

### Embed Badge

![Health badge](/badges/apancutt-bsutils/health.svg)

```
[![Health](https://phpackages.com/badges/apancutt-bsutils/health.svg)](https://phpackages.com/packages/apancutt-bsutils)
```

###  Alternatives

[nostalgiaz/bootstrap-switch

Turn checkboxes and radio buttons into toggle switches.

5.0k362.3k4](/packages/nostalgiaz-bootstrap-switch)[matthiasmullie/minify

CSS &amp; JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.

2.0k30.5M336](/packages/matthiasmullie-minify)[onokumus/metismenu

A jQuery menu plugin

2.0k263.3k5](/packages/onokumus-metismenu)[bostondv/bootstrap-ninja-forms

Adds Bootstrap classes to Ninja Forms

222.2k](/packages/bostondv-bootstrap-ninja-forms)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
