aanckar / react-pdf-tailwind

Use Tailwind CSS to style PDFs created with react-pdf
315 stars 11 forks source link

Refactor: change export/import behaviour #8

Closed hwb15 closed 1 year ago

hwb15 commented 1 year ago

What kind of change does this PR introduce?

Major change to the way the createTw is imported and exported to allow for the ability to use it within the react pdf playground/interactive debugger app react-pdf-repl.

To make sure the module can be imported within react-pdf-repl, it needs to be a named export rather than default.

What is the current behavior?

createTw is currently exported as followed:

...
export default createTw

Then it is imported as followed:

import createTw from 'react-pdf-tailwind'

What is the new behavior?

Now exported as named:

...
export { createTw }

Then imported as named:

import { createTw } from 'react-pdf-tailwind'
aanckar commented 1 year ago

Thanks for this - I will probably merge this at some point (new major release), seeing that named exports have many benefits over default exports overall.

hwb15 commented 1 year ago

@aanckar Perfect! If you'd be up for merging it asap I can then get it up and running today within the 'react-pdf-repl', so we can use tailwind within live updating/debugging environment while creating pdfs.

aanckar commented 1 year ago

This is implemented now in v2.0.0. Ended up adding this as part of a bigger refactor, so closing this now.

hwb15 commented 1 year ago

This is implemented now in v2.0.0. Ended up adding this as part of a bigger refactor, so closing this now.

Looks good! I'll have a look at getting this into the repl now