With grunt
, I could use command grunt bower
(provided by grunt-bower-requirejs
) to auto-generate RequireJS
config file for my local bower
components.
Is there any plugin for gulp
to perform similar task?
With grunt
, I could use command grunt bower
(provided by grunt-bower-requirejs
) to auto-generate RequireJS
config file for my local bower
components.
Is there any plugin for gulp
to perform similar task?
Mind that bowerRequireJS is an asynchronous function. So you would need to use a callback (or synchronously return a Promise) to mark that task as asynchronous like so:
gulp.task('bower', function(callback) {
var options = {
baseUrl: 'src',
config: 'src/app/require.config.js',
transitive: true
};
bowerRequireJS(options, function (rjsConfigFromBower) {
callback();
});
});
UPDATE: for future readers, please look at the correct answer from @user2326971
Solved it by hook up gulp
directly with node module bower-requirejs
npm install bower-requirejs --save-dev
In gulpfile.js
var bowerRequireJS = require('bower-requirejs');
gulp.task('bower', function() {
var options = {
baseUrl: 'src',
config: 'src/app/require.config.js',
transitive: true
};
bowerRequireJS(options, function (rjsConfigFromBower) {
console.log("Updated src/app/require.config.js !");
});
});