Skip to content

Commit

Permalink
Merge pull request #71 from krakenjs/fix.json.import
Browse files Browse the repository at this point in the history
make sure we can resolve JSON imports without .json file extension
  • Loading branch information
gabrielcsapo authored Jul 18, 2017
2 parents 79c6ec8 + fcecaab commit de562a0
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 de562a0

Please sign in to comment.