Gathering detailed insights and metrics for grunt-bower-requirejs
Gathering detailed insights and metrics for grunt-bower-requirejs
Gathering detailed insights and metrics for grunt-bower-requirejs
Gathering detailed insights and metrics for grunt-bower-requirejs
grunt-bower-requirejs-alias
Automagically wire-up installed Bower components into your RequireJS config
grunt-bower-requirejs-config-generator
A generator of require config file with paths and shims, getting informations from bower.json
generator-angular-requirejs-grunt-bower
Integrate AngularJs, Requirejs, Grunt and Bower with your project.
grunt-bower-server
running a requirejs server, the server manages bower components
[DEPRECATED] Grunt task - Automagically wire-up installed Bower components into your RequireJS config
npm install grunt-bower-requirejs
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
198 Stars
56 Commits
20 Forks
22 Watchers
1 Branches
25 Contributors
Updated on May 07, 2024
Latest Version
2.0.0
Package Id
grunt-bower-requirejs@2.0.0
Size
3.07 kB
NPM Version
2.1.16
Node Version
0.10.32
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
Automagically wire-up installed Bower components into your RequireJS config
Grunt wrapper for the bower-requirejs module.
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, install this plugin with this command:
1npm install grunt-bower-requirejs --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
1grunt.loadNpmTasks('grunt-bower-requirejs');
1grunt.initConfig({
2 bower: {
3 target: {
4 rjsConfig: 'app/config.js'
5 }
6 }
7});
8
9grunt.loadNpmTasks('grunt-bower-requirejs');
10
11grunt.registerTask('default', ['bower']);
When the bower
task is run it merges the paths of installed Bower components into the paths
property of your RequireJS config.
You trigger this task from another task in your Gruntfile or through the CLI: grunt bower
Required
Type: String
Specify a relative path to your RequireJS config.
Make sure to specify the baseUrl
property in your RequireJS config if you want to use relative paths.
Default: []
Type: Array
Specify components to be excluded from being added to the RequireJS config.
1bowerRequirejs: { 2 all: { 3 rjsConfig: '<%= yeoman.app %>/scripts/main.js', 4 options: { 5 exclude: ['modernizr', 'sass-bootstrap', 'qtip2'] 6 } 7 } 8}
Default: null
Type: String
Generate paths relative to a specific directory. This option is for anyone not using data-main
who wishes to set their own base.
1bowerRequirejs: { 2 all: { 3 rjsConfig: '<%= yeoman.app %>/path/to/main.js', 4 options: { 5 baseUrl: './' 6 } 7 } 8}
Default: false
Type: Boolean
If the transitive option is set to true
, then transitive dependencies will be also added to the require config.
For example, say we explicitly have an entry in our bower config for module myTotallyCoolModule
, which depends on jQuery
and underscore
. If the transitive option is set to true
, there will be config entries for myTotallyCoolModule
, jQuery
, and underscore
. Otherwise, if the transitive option is set to false
, there will only be a config entry for myTotallyCoolModule
.
Each transitive dependency is only included once, even if the dependency is used multiple times.
1bowerRequirejs: { 2 all: { 3 rjsConfig: '<%= yeoman.app %>/scripts/main.js', 4 options: { 5 transitive: true 6 } 7 } 8}
Default: false
Type: Boolean
If the excludeDev option is set to true
, then dev-pendencies won't be added to the require config.
1bowerRequirejs: { 2 all: { 3 rjsConfig: '<%= yeoman.app %>/scripts/main.js', 4 options: { 5 'exclude-dev': true 6 } 7 } 8}
Bower >=v1.3.1 includes hooks for preinstall
, postinstall
and preuninstall
actions. To run grunt-bower-requirejs after every bower install, add a scripts
block to your .bowerrc
.
{
"scripts": {
"postinstall": "grunt bower"
}
}
If you do not already have a config.js
file at the location specified by the --config
option then one will be generated for you. A basic config.js
file looks like this:
1requirejs.config({ 2 shim: {}, 3 paths: {} 4});
You still need to create a path for your js files. This tool will only create paths for third party libraries specified in bower.json
.
1requirejs.config({ 2 shim: {}, 3 paths: { 4 myComponent: 'js/myComponent.js' // make sure to add your components! 5 } 6});
The tool does not overwrite the config file, it just adds additional paths to it. So paths you add will be preserved. Keep in mind that if you change or remove one of your Bower dependencies after you've run the task, that path will still exist in the config file and you'll need to manually remove it.
Although RequireJS does not provide a bower.json
file, a path to require.js
will still be created in your rjsConfig
file. The path's name will be requirejs
. If you are optimizing your scripts with r.js
you can use this path to make sure RequireJS is included in your bundle.
If a dependency's moduleType
is set to node
in bower.json
it will be treated as a CommonJS Package.
The following bower.json
file:
1{ 2 "name": "node-module-type-stub", 3 "version": "0.0.1", 4 "moduleType": ["node"], 5 "main": "myMain.js" 6}
Will generate this entry in your config.js
file:
require.config({
shim: {},
packages: [
{
name: 'node-module-type-stub',
main: 'myMain.js',
location: 'bower_components/node-module-type-stub'
}
],
paths: {}
});
By default, the task will set the package location
to the root directory of the dependency. If the dependency includes a location
property in its bower.json
, then the location will be a combination of the root directory and the location dir.
For example, a bower.json like this:
1{ 2 "name": "node-module-type-stub", 3 "version": "0.0.1", 4 "moduleType": ["node"], 5 "main": "myMain.js", 6 "location": "src" 7}
Will generate this entry in your config.js
file:
1require.config({ 2 shim: {}, 3 packages: [ 4 { 5 name: 'node-module-type-stub', 6 main: 'myMain.js', 7 location: 'bower_components/node-module-type-stub/src' 8 } 9 ], 10 paths: {} 11});
BSD license and copyright Google
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
security policy file detected
Details
Reason
Found 5/30 approved changesets -- score normalized to 1
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More