Skip to content

Instantly share code, notes, and snippets.

@benmccormick
Created January 12, 2015 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benmccormick/d2bc1b35ecd4eb78a4ac to your computer and use it in GitHub Desktop.
Save benmccormick/d2bc1b35ecd4eb78a4ac to your computer and use it in GitHub Desktop.
Configuration file to load a requirejs config both in gulp and the browser
/* jshint ignore:start */
/** This file is a bit of a hack to make the requireJS build paths available
* both in the browser and for gulp. There's some ugliness requires to make
* it loadable/usable in both environments.
**/
var requirePaths = {
paths: {
jquery: 'vendor/jquery/jquery',
jqueryui: 'vendor/jquery/jquery.ui',
//...
},
shim: {
/...
}};
//if this is being pulled in as a node module, nest it, otherwise we'll
// run the browser specific logic
if (typeof exports !== 'undefined') {
exports.requirePaths = requirePaths;
}else if(require) {
var config = {
paths: requirePaths.paths,
shim: requirePaths.shim,
map: requirePaths.map,
baseUrl: static_url+'/js/'
};
require.config(config);
}
/* jshint ignore:end *//* jshint ignore:start */
/** This file is a bit of a hack to make the requireJS build paths available
* both in the browser and for gulp. There's some ugliness requires to make
* it loadable/usable in both environments.
**/
var requirePaths = {
paths: {
jquery: 'vendor/jquery/jquery',
jqueryui: 'vendor/jquery/jquery.ui',
//...
},
shim: {
/...
}};
//if this is being pulled in as a node module, nest it, otherwise we'll
// run the browser specific logic
if (typeof exports !== 'undefined') {
exports.requirePaths = requirePaths;
}else if(require) {
var config = {
paths: requirePaths.paths,
shim: requirePaths.shim,
map: requirePaths.map,
baseUrl: static_url+'/js/'
};
require.config(config);
}
/* jshint ignore:end */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment