grunt-bower-linker

0.1.4 • Public • Published

grunt-bower-linker

Collect main sources from bower packages and link them in the desired directories.

Getting Started

This plugin requires Grunt ~0.4.2

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-bower-linker --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-bower-linker');

The "bower_linker" task

Overview

In your project's Gruntfile, add a section named bower_linker to the data object passed into grunt.initConfig().

grunt.initConfig({
  'bower-linker': {
    default: {
      options: {
        root: 'linker',     // The root directory to place linked sources.
        map: {
          '*.js': '/js',    // Sub directories to link specific source types.
          '*.css': '/css',
          '*': '/', 
        }
      }
    }
  },
});

Options

copy

Type Boolean Default: false

If set to true the main files from each package will be copied instead of linked.

cwd

Type: String Default: '.'

The path to the current working directory which houses either a bower_components directory or a .bowerrc file.

force

Type: Boolean Default: false

Whether or not to force linking main files, overwriting existing files at the destination.

map

Type: Object Default: { '*': '/' }

An object containing key/value pairs describing how files should be linked in the root directory. The following example shows a map object which places .css files and .js files in separate directories and all other files in the root directory.

{
  '*.js': '/js',
  '*.css': '/styles'
  '*': '/'
}

Note: grunt-bower-link uses minimatch to parse the map object.

offline

Type: Boolean Default: true

Whether or not to run bower commands in offline mode. Offline mode is much faster.

Node: There is no benefit to running this task in online mode. This option is kept for potential use in the future.

root

Type: String Default: linker

The directory to place linked files in.

vendor

Type: Boolean Default: false

If this option is set to true, main files will be disseminated through an intermediate directory named after their package. For example, if you have installed twitter bootstrap through bower it will place the sources in the follow manner:

+ root
  + bootstrap
      bootstrap.css
      bootstrap.js
      fonts.otf
      ...
  + jquery
      jquery.js

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.4
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.4
    1
  • 0.1.3
    0
  • 0.1.2
    0
  • 0.1.1
    0
  • 0.1.0
    0

Package Sidebar

Install

npm i grunt-bower-linker

Weekly Downloads

1

Version

0.1.4

License

none

Last publish

Collaborators

  • markschad