BjornTheProgrammer / bun-plugin-html

A plugin for bun build which allows html entrypoints
MIT License
34 stars 2 forks source link

Add configuration options #5

Closed speelbarrow closed 11 months ago

speelbarrow commented 11 months ago

Changes made:

BjornTheProgrammer commented 11 months ago

Thank you for your contributions @speelbarrow, I'll include your contributions and code in the larger rewrite that I'm going to make soon. Although I'll merge the pull request, the release will come after this rewrite which fixes some of the other issues.

BjornTheProgrammer commented 11 months ago

Hello @speelbarrow, I've finished that larger rewrite I was talking about. Here are the key updates regarding your implementation.

1) I switched to the much more verbose method of detecting extensions using path.extname, as such to filter out files you have to specify the extension name as if it would be returned from path.extname.

from

await Bun.build({
    entrypoints: ['./test/starting/index.html'],
    outdir: generationDirectory,
    plugins: [html({filter: ['css', 'ico', 'tsx']})],
})

to

await Bun.build({
    entrypoints: ['./test/starting/index.html'],
    outdir: generationDirectory,
    plugins: [html({filter: ['.css', '.ico', '.tsx']})],
})

2) If the file is filtered out then it will not be outputted into the build directory. 3) tsx and jsx files now all compile as expected

Please let me know within 24 hours whether you have any changes you'd like to add to this implementation. Since I plan to make a new release then.

speelbarrow commented 11 months ago

Hello @speelbarrow, I've finished that larger rewrite I was talking about. Here are the key updates regarding your implementation.

  1. I switched to the much more verbose method of detecting extensions using path.extname, as such to filter out files you have to specify the extension name as if it would be returned from path.extname.

from

await Bun.build({
  entrypoints: ['./test/starting/index.html'],
  outdir: generationDirectory,
  plugins: [html({filter: ['css', 'ico', 'tsx']})],
})

to

await Bun.build({
  entrypoints: ['./test/starting/index.html'],
  outdir: generationDirectory,
  plugins: [html({filter: ['.css', '.ico', '.tsx']})],
})
  1. If the file is filtered out then it will not be outputted into the build directory.
    1. tsx and jsx files now all compile as expected

Please let me know within 24 hours whether you have any changes you'd like to add to this implementation. Since I plan to make a new release then.

Sounds good to me! Thanks for everything :)