Skip to content

Instantly share code, notes, and snippets.

@cwparsons
Last active July 10, 2018 23:53
Show Gist options
  • Save cwparsons/30157339b16b81c5e44f49103728d23f to your computer and use it in GitHub Desktop.
Save cwparsons/30157339b16b81c5e44f49103728d23f to your computer and use it in GitHub Desktop.
User configuration for a gulpfile.

We use the following to allow different users or computers to have their own gulp configuration.

/**
* Get the normal configuration entry, and if a user one exists, merge those values in.
*/
module.exports = () => {
const defaultConfig = require('./gulp-config');
try {
const devConfig = require('./gulp-dev-config');
if (devConfig) {
return Object.assign(defaultConfig, devConfig);
}
} catch (e) {
return defaultConfig;
}
};
// The normal configuration json file.
{
"projectFolder": "C:\\inetpub\\Sitecore\\Website"
}
// Create a user configuration json file.
{
"projectFolder": "D:\\Sitecore\\Website"
}
// Create an example file to help developers understand the functionality is available.
{
"projectFolder": ""D:\\Sitecore\\Website"
}
// Run the config utility immediately.
const config = require('./config')();
{
"devDependencies": {
"gulp": "3.9.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment