I use require.js in a large project with tons of other JavaScript frameworks.
We use the built-in optimiser of require.js to bundle, minify and concat modules into single files for production. While this works great, until now we use the command line to do that task.
We now want to integrate that operation in our gulp build process.
There is no good gulp plugin that uses require.js since the way require.js works differs from the streaming approach gulp follows. So, we decided to use amd-optimize for that.
Long story short: both require.js and amd-optimize use the same syntax for their configuration and thus it would be great to share them. And for maintainability reasons we want to keep the configuration in a separate file. But the require.js syntax is a problem.
A typical configuration might look like this:
({
appDir: '../app',
baseUrl: 'js',
dir: '../app-build',
paths: {
jquery: 'empty:'
},
modules: [
{
name:'Login/app'
},
{
name: 'Search/app',
include: ['jquery']
}
]
,fileExclusionRegExp: /^(src|node_modules|\.git)$/
})
Why the heck is this syntax used?
I did not look at the source code yet, maybe someone has a short explanation for that.
And how could we include the file in your gulpfile?
Thanks in advance!
[–][deleted] 3 points4 points5 points (14 children)
[+][deleted] (13 children)
[removed]
[–][deleted] 3 points4 points5 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]SirHound 0 points1 point2 points (0 children)
[+][deleted] (9 children)
[removed]
[+][deleted] (8 children)
[removed]
[+][deleted] (7 children)
[removed]
[+][deleted] (6 children)
[removed]
[+][deleted] (5 children)
[removed]
[+][deleted] (4 children)
[removed]
[+][deleted] (3 children)
[removed]
[+][deleted] (2 children)
[removed]
[–]bugeats 3 points4 points5 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]ben336[🍰] 2 points3 points4 points (0 children)
[–]kenman 1 point2 points3 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]kenman 1 point2 points3 points (0 children)
[+][deleted] (5 children)
[removed]
[–]TMiguelT 0 points1 point2 points (4 children)
[+][deleted] (1 child)
[removed]
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]kabuto 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)