bower-installer

null

License

License

Categories

Categories

Gradle Build Tools
GroupId

GroupId

com.craigburke.gradle
ArtifactId

ArtifactId

bower-installer
Last Version

Last Version

1.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

bower-installer
null
Project URL

Project URL

https://github.com/craigburke/bower-installer-gradle
Source Code Management

Source Code Management

https://github.com/craigburke/bower-installer-gradle

Download bower-installer

How to add to project

<!-- https://jarcasting.com/artifacts/com.craigburke.gradle/bower-installer/ -->
<dependency>
    <groupId>com.craigburke.gradle</groupId>
    <artifactId>bower-installer</artifactId>
    <version>1.3.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.craigburke.gradle/bower-installer/
implementation 'com.craigburke.gradle:bower-installer:1.3.0'
// https://jarcasting.com/artifacts/com.craigburke.gradle/bower-installer/
implementation ("com.craigburke.gradle:bower-installer:1.3.0")
'com.craigburke.gradle:bower-installer:jar:1.3.0'
<dependency org="com.craigburke.gradle" name="bower-installer" rev="1.3.0">
  <artifact name="bower-installer" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.craigburke.gradle', module='bower-installer', version='1.3.0')
)
libraryDependencies += "com.craigburke.gradle" % "bower-installer" % "1.3.0"
[com.craigburke.gradle/bower-installer "1.3.0"]

Dependencies

runtime (1)

Group / Artifact Type Version
org.codehaus.groovy : groovy-all jar 2.3.10

Project Modules

There are no modules declared in this project.

Bower Installer Gradle Plugin

Note
This plugin has been officially replaced with the client dependencies gradle plugin.

The Gradle plugin uses bower-installer to manage client-side dependencies alongside the other dependencies in build.gradle.

Getting Started

plugins {
    id 'com.craigburke.bower-installer' version '2.5.1'
}

Tasks

The plugin adds the following tasks to your build:

Task

Description

bowerInstall

Installs all the bower dependencies you have set in your build.gradle

bowerRefresh

Refreshes bower dependencies (if you add or modify your bower configuration)

bowerClean

Removes bower dependencies and clears Bower’s cache

Configuration

You can specify dependencies as well as control where files are installed to with the provided dependency DSL.

plugins {
    id 'com.craigburke.bower-installer' version '2.5.1'
}

bower {
    installBase = 'src/assets/bower' // <1>

    'angular'('1.3.x') {
        source 'angular.js' // <2>
    }

    'angular-animate'('1.3.x') {
        source 'angular-animate.js' >> '/angular/modules/' // <3>
    }

    'ui-router'('0.2.x') // <4>

    'bootstrap'('3.3.x') {
        source 'dist/css/*.min.css' >> 'styles/'
        source 'dist/fonts/**' >> 'fonts/'

        excludes 'jquery' // <5>
    }

    'animate.css'('https://github.com/daneden/animate.css.git') // <6>
}
  1. installBase is the base path that the bower dependencies are installed to

  2. This copies the angular.js file to the default location (src/assets/bower/angular/angular.js)

  3. An absolute path is used here so angular-animate.js will be copied to src/assets/bower/angular/modules/angular-animate.js

  4. When no sources are specified the default behavior of bower-installer determines which files are included

  5. Exclude the transitive dependency jquery

  6. Use a git repository as a dependency source

Note
if installBase is not set, it defaults to src/assets/bower or grails-app/assets/bower in a Grails 3 application.

Adding Dependencies

By default, bower-installer will install only the main files listed in that project’s bower.json file.

Sometimes you need additional files that aren’t listed as the main files. In cases like that first start by including the entire reposistory:

bower {
    'bootstrap'('3.3.x') {
        source '**' // (1)
    }
}
  1. This installs all the files within the bootstrap repo to src/assets/bower/bootstrap/

From there you can be more selective about what files you actually want installed and where

bower {
    'bootstrap'('3.3.x') {
        source 'dist/**' // (1)
    }
}
  1. This installs everything contained within the dist folder (including subfolders) into src/assets/bower/bootstrap/

Note
Every time you make a changes to your bower dependencies you must run the bowerRefresh task.

Advanced Configuration

bower {
    additional = [ // (1)
        name: 'gradle-bower-installer'
    ]
}
  1. additional allow you to set optional properties in the generated bower.json file.

Troubleshooting

If you set the bowerDebug property when you run bowerInstall then you’ll get more detailed output and both the bower.json file and the bower_components folder will remain to help troubleshoot.

./gradlew bowerInstall -PbowerDebug=true

Contributions

Thank you to the following people who have made major contributions in terms of both feedback and code:

Versions

Version
1.3.0
1.2.0
1.1.1
1.1.0
1.0.0