New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for --config with JSON file #16
Conversation
|
Hey @menghif, thanks so much for the changes so far. It looks really good! Just some small things I wanted to point out: Styling
Error-handling
|
|
I made the requested changes, except for adding Line 265 in cdc6e7c
I also added the following if statement: Line 185 in cdc6e7c
to avoid passing a file that is not |
|
Hey @menghif sorry for so much back and forth. I tried testing it again and I noticed that it throws an error when the config file doesn't specify an output folder. For example, if you test using It throws an error instead of saving in the default 'dist' folder. One more thing is that if the JSON config file doesn't exist at all, the error message that is printed is 'Input file or folder is required'. I think that a more accurate message would be something like 'JSON config file is required'. You could add an else statement after this code block. Thank you so much!!! |
…message when JSON file does not exist.
|
I'm really seeing the benefit of code review now! Thank you for your help catching those two problems. I fixed them now! Hopefully it's good now 😊 |
|
@menghif Thanks so much! It looks great, I'll be merging it now :) |
Fixes #15
This PR adds a
--configoption to specify all of the other SSG options in a JSON formatted configuration file.Example:
node index.js --config options.jsonwhere options.json is equal to:
would be the equivalent of doing
node index.js -i ./docs -o ./webI still need to update the README to document the changes.