diff --git a/README.md b/README.md
index 966e79e..e61c17c 100644
--- a/README.md
+++ b/README.md
@@ -191,7 +191,13 @@ With `--no-dotfiles` files starting with `.` are ignored.
Run through without making any changes. This can be very usefull, because it outputs what would happend without doing anything.
+#### --cname
+ * __optional__
+ * Default: `No CNAME file is generated`
+ * Example:
+ * `ngh --cname=example.com`
+A CNAME file will be created enabling you to use a custom domain. [More information on Github Pages using a custom domain](https://help.github.com/articles/using-a-custom-domain-with-github-pages/).
## FAQ
diff --git a/bin/angular-cli-ghpages b/bin/angular-cli-ghpages
index 387f59b..9d2b6f2 100644
--- a/bin/angular-cli-ghpages
+++ b/bin/angular-cli-ghpages
@@ -15,6 +15,7 @@ program
.option('-e, --email ', 'The git user-email which is associated with this commit')
.option('-S, --no-silent', 'Logging is in silent mode by default. The option enables extended console logging. Keep this untouched if the repository URL or other information passed to git commands is sensitive!')
.option('-T, --no-dotfiles', 'Includes dotfiles by default. When set files starting with `.` are ignored.')
+ .option('-c, --cname ', 'Generate a CNAME for the specified domain')
.option('--dry-run', 'For testing: Run through without making any changes.')
.parse(process.argv);
diff --git a/index.js b/index.js
index 4dd81a0..24ee8ed 100644
--- a/index.js
+++ b/index.js
@@ -87,11 +87,23 @@ exports.run = function (options) {
user: options.user || 'undefined: local or gloabl git username & email properties will be taken',
noSilent: options.noSilent || 'undefined: logging is in silent mode by default',
noDotfiles: options.noDotfiles || 'undefined: dotfiles are included by default',
- dryRun: options.dryRun
+ dryRun: options.dryRun,
+ cname: options.cname || 'undefined: no CNAME file will be created',
});
return;
}
+ if (options.cname) {
+ console.log('CNAME option is present with value: ' + options.cname);
+ fs.writeFile(path.join(dir, 'CNAME'), options.cname, function (err) {
+ if (err) {
+ console.log(err);
+ } else {
+ console.log('CNAME file created');
+ }
+ })
+ }
+
return publish(dir, options)
})
.then(function showSuccess() {