Skip to content

[fix]: Cannot use config file without json extension #255

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

Closed
carlosjeurissen opened this issue Aug 16, 2017 · 1 comment
Closed

[fix]: Cannot use config file without json extension #255

carlosjeurissen opened this issue Aug 16, 2017 · 1 comment
Labels
Milestone

Comments

@carlosjeurissen
Copy link

Config files without a json extension, for example ".posthtmlrc" can't be used. This is due to the use of require to fetch the config file.

Please consider replacing require with:
JSON.parse(fs.readFileSync(argv.config, 'utf8'))

Talking of which, the config file gets fetched once for each file you process. To solve this, please consider fetching the config file only once, like this:

var cfgData = argv.config && JSON.parse(fs.readFileSync(argv.config, 'utf8'));

and use it in the processing file like this:
var cfg = cfgData ? Object.keys(cfgData) : [];
and
if (cfgData) {config = Object.assign(cfgData, config)}

@Scrum
Copy link
Member

Scrum commented Aug 22, 2017

@carlosjeurissen HI, hanks, I'll think, it may be PR ?

@Scrum Scrum added the perf label Aug 22, 2017
@Scrum Scrum added this to the 0.3.1 milestone Aug 22, 2017
@Scrum Scrum changed the title Cannot use config file without json extension [perf] Cannot use config file without json extension Aug 22, 2017
@Scrum Scrum changed the title [perf] Cannot use config file without json extension [perf]: Cannot use config file without json extension Aug 22, 2017
@Scrum Scrum modified the milestones: 0.3.2, 0.3.1 Aug 29, 2017
@Scrum Scrum added bug and removed perf labels Sep 6, 2017
@Scrum Scrum modified the milestones: 0.3.1, 0.3.2 Sep 6, 2017
@Scrum Scrum changed the title [perf]: Cannot use config file without json extension [fix]: Cannot use config file without json extension Sep 6, 2017
Scrum added a commit that referenced this issue Oct 10, 2017
@Scrum Scrum closed this as completed in 25c6bb0 Oct 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants