Skip to content

Commit

Permalink
make sure we can resove JSON imports without .json file extension
Browse files Browse the repository at this point in the history
  • Loading branch information
grawk committed Jul 18, 2017
1 parent 79c6ec8 commit fcecaab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ export default class Handlers {
let shorty = Shortstop.create();

shorty.use('import', function (file, cb) {
//check for json extension
file = (/\.json$/.test(file)) ? file : `${file}.json`;
try {
file = path(file);
return shorty.resolve(loadJsonicSync(file), cb);
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/import/child.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "child",
"grandchild": "import:./grandchild.json"
"grandchild": "import:./grandchild"
}

0 comments on commit fcecaab

Please sign in to comment.