-
-
Save Saturate/8006167 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// method used by requirejs to decide which modules to include | |
// since we want to be able to package a bunch of modules in both | |
// public internet area as well as in edit mode | |
var includeModulesByFolder = function(folder, baseIncludes){ | |
var fs = require('fs'), | |
glob = require('glob'), | |
include = [], | |
baseIncludes = typeof baseIncludes !== 'undefined' ? baseIncludes : []; | |
glob.sync( folder + '/**/*.js', { dot: false }).forEach(function(filename) { | |
include.push(filename.replace('./js/', '')); | |
}); | |
return baseIncludes.concat(include); | |
}; | |
requirejs: { | |
dist: { | |
options: { | |
preserveLicenseComments: false, | |
dir: 'dist/js/', | |
mainConfigFile: 'frontend/js/setup.js', | |
locale: 'da-dk', | |
baseUrl: './frontend/js', | |
optimize: 'uglify2', | |
optimizeCss: 'none', | |
removeCombined: false, // we want to preserve combined files, since they're needed in the SP solution | |
loglevel: 2, | |
force: true, | |
modules: [ | |
{ | |
name: 'custom/main', | |
include: (includeModulesByFolder('custom', ['jquery'])) | |
}, | |
{ | |
name: 'edit/main', | |
include: (includeModulesByFolder('edit', ['jquery'])) | |
} | |
] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment