Skip to content

Commit

Permalink
feat: move addImport call outside traversal
Browse files Browse the repository at this point in the history
  • Loading branch information
finkef committed Sep 29, 2021
1 parent 00c4cfb commit 4ee9fde
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/macro/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ const macro = (params: MacroParams & { source: string }) => {
babel: { types: t },
} = params

// const { default: tw = [] } = references

const program = state.file.path

addImport({ ...params, t, path: program, program })

/**
* Traverse and collect all tw props on the surrounding component function in a first run.
*/
Expand All @@ -38,11 +38,6 @@ const macro = (params: MacroParams & { source: string }) => {
program,
})

/**
* Imports createUseTailwindStylesHook.
*/
addImport({ ...params, path, t, program })

component.state.stylesIdentifier =
component.scope.generateUid("tailwindStyles")
component.state.useStylesIdentifier =
Expand Down

0 comments on commit 4ee9fde

Please sign in to comment.