Skip to content

Commit

Permalink
fix: fix expandProps when position is not allowed
Browse files Browse the repository at this point in the history
Also fix option in website.
  • Loading branch information
gregberge committed Sep 30, 2018
1 parent 169eb2f commit 45522fc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
7 changes: 4 additions & 3 deletions packages/core/src/h2x/expandProps.js
Expand Up @@ -12,12 +12,13 @@ const expandProps = (position = 'end') => () => ({
props.name = 'props'
props.spread = true
if (position === 'start') {
path.node.attributes.unshift(props)
path.node.attributes = [props, ...path.node.attributes]
path.replace(path.node)
}
if (position === 'end') {
path.node.attributes.push(props)
path.node.attributes = [...path.node.attributes, props]
path.replace(path.node)
}
path.replace(path.node)
}
},
},
Expand Down
16 changes: 9 additions & 7 deletions website/config/settings.js
Expand Up @@ -24,13 +24,6 @@ export const settings = [
group: 'global',
default: false,
},
{
label: 'Expand props',
name: 'expandProps',
type: 'boolean',
group: 'global',
default: true,
},
{
label: 'Ref',
name: 'ref',
Expand All @@ -45,6 +38,15 @@ export const settings = [
group: 'global',
default: false,
},
{
label: 'Expand props',
name: 'expandProps',
type: 'enum',
values: ['start', 'end', 'none'],
group: 'global',
default: 'end',
transform: value => value === 'none' ? false : value,
},
{
label: 'Replace attributes value',
name: 'replaceAttrValues',
Expand Down

0 comments on commit 45522fc

Please sign in to comment.