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

laravel-elixir-bowerbundle

v2.2.0

Published

Concatenates bower dependencies into configurable bundles of .css and .js files

Downloads

19

Readme

laravel-elixir-bowerbundle Dependencies Status Build Status Coverage Status

Concatenates and publishes Bower dependencies as configurable bundles of .css and .js files.

This is a plugin for Laravel's Elixir build tool and provides the bower() method.

elixir(function (mix) {

  // Create a single bundle.js file that contains jQuery and a couple
  // of plugins. Simply include bundle.js somewhere on your page and
  // it works - no shims, no need for multiple require()s
  mix.bower(['jquery', 'jquery-touchswipe', 'Scrollify']);

  // Save the concatenated files somewhere other than the default
  // location by passing a second argument. If you're creating
  // multiple bundles, you'll need this.
  mix.bower(['jquery', ...], 'public/vendor/bower.js');

  // What about packages that include CSS? Not a problem, it just works.
  // All stylesheets used in the named packages are concatenated together
  // to a single bundle.css file, much like the javascript.
  mix.bower(['jquery', 'leaflet']);
  // Even images and fonts are automatically published alongside the
  // css and js, assuming the package lists them as `main` files. And
  // if it doesn't, see "Specify which files you want from a package" below.

  // Don't like the idea of mixing your list of dependencies with your
  // build logic? You can use bower.json to store your bundle compositions, e.g.
  // {
  //    "bundles": {
  //      "frontend": ["jquery", "lodash"],
  //      "admin": ["angular", "angular-ui-router", "d3"]
  //    }
  // }
  // then call .bower() with a named bundle
  mix.bower('frontend');
  // or call without arguments to publish all the defined bundles
  mix.bower();

});

Install from npm

npm install laravel-elixir-bowerbundle --save

Usage

// gulpfile.js
var elixir = require('laravel-elixir');
require('laravel-elixir-bowerbundle');

elixir(function(mix) {
  mix.bower(['jquery', 'lodash']);
});
Specify which files you want from a package

Bower packages have a bower.json file with a "main" property. This is how we know which files from each package should be included in the bundle. You can override this in your own bower.json with an "overrides" property.

Example: the bootstrap bower package lists bootstrap.less as one of its main files. To get the compiled CSS instead, override the "main" property for the "bootstrap" package.

{
  "overrides": {
    "bootstrap": {
      "main": [
        "dist/css/bootstrap.css",
        "dist/js/bootstrap.js"
      ]
    }
  }
}
Use your own build pipeline

Is the standard mix.bower() task not quite right for you? You can still use this package to fetch the list of files for a bundle, then pass them to gulp.src() in your own custom gulp task. For example:

// gulpfile.js
var elixir = require('laravel-elixir');
var bundle = require('laravel-elixir-bowerbundle');
var gulp   = require('gulp');

// Use elixir as normal, remembering to call your custom task
elixir(function (mix) {
  mix.task('customBowerTask')
     // ...
});

// Define your custom task
gulp.task('customBowerTask', function () {

  // Pass an array of package names to the bundle factory function,
  // then get the file list with .all(). You can also use .css(),
  // .js() or .misc() to get files of a certain type.
  var files = bundle(['jquery']).all();

  return gulp.src(files)
             .pipe()
              // ...
});

Contributing

All contributions welcome.

License

MIT