Skip to content

Commit

Permalink
convert name of imported fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
hax committed Jul 21, 2015
1 parent 4531cca commit 7527462
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 6 additions & 1 deletion new-src/transform.js
Expand Up @@ -33,11 +33,16 @@ function loadTree(name) {
if (existsSync(path + '.jedi')) path += '.jedi'
let tree = parseFile(path)
tree = transformImport(tree)
if (!frag) return tree
if (!frag) {
tree[0] = 'fragment'
tree[2] = name + '#'
return tree
}
tree = tree::query(({nodeType, nodeName, nodeValue, id}) =>
nodeType === 'fragment' && nodeName === frag && nodeValue === undefined
|| nodeType === 'element' && id === frag)
if (!tree) throw new Error('Failed to load ' + name)
tree[2] = name
return tree
}

Expand Down

0 comments on commit 7527462

Please sign in to comment.