There is a gulp-requirejs plugin, but a blacklist with the following message: "use require.js directly.
The documents are pretty sparse, how would you best use it in conjunction with the Gulp build <task? >
There is an example in docs :
var requirejs = require('requirejs'); var config = { baseUrl: '../appDir/scripts', name: 'main', out: '../build/main-built.js' }; requirejs.optimize(config, function (buildResponse) {
But it doesnβt help me much ... Here is my best attempt:
var gulp = require('gulp'), r = require('requirejs').optimize; var config2 = { baseUrl: 'src/js', name: 'config', out: 'dist/js/main-built.js' }; gulp.task('scripts3', function() { gulp.src(['src/js/**/*.js']) .pipe(r(config) .pipe(gulp.dest(config.out)) });
But the requirejs module does not use threads, so it will not work.
There is also a very gulp friendly amd-optimize , but it does not match r.js.
any_h source share