wewowweb / laravel-mix-svelte

mix.svelte();
MIT License
68 stars 10 forks source link

Enabling new filetypes to match svelte-loader rules #16

Closed chewbakartik closed 2 years ago

chewbakartik commented 2 years ago

I have been wanting to add support for Markdown to some applications that I have running Laravel + Svelte and really appreciate the work put in to making this mix extension. However, there's some limitations that don't allow for extra plugins that use custom file extensions like mdsvex (https://mdsvex.com/). This commit allows some extra configuration to be passed through to webpack, to enable different file extensions to be managed by svelte-loader. People not using this extra functionality don't need to make any changes to their existing config.

An example for usage using mdsvex:

const mix = require('laravel-mix');
require('laravel-mix-svelte');
const { mdsvex } = require('mdsvex');

mix.svelte({
  preprocess: mdsvex({
      extensions: [".svx", ".md"]
    })
}, ['.svx', '.md'])

This can be simplified or expanded depending on usage, but the change would allow the end user to decide what extensions get passed to svelte-loader.

morpheus7CS commented 2 years ago

Hey @chewbakartik,

sorry for the late response, life has been a little hectic recently. 😞

This is a nice API in my opinion. We might modify it slightly in the future, but it allows the developers to have some flexibility in how they are using the package.

Thanks for contributing. I've added a Hacktoberfest tag, just in case you are participating.

Kind regards, g

chewbakartik commented 2 years ago

That's awesome, thanks @morpheus7CS. No worries, I get how time constraints can impact things. I'm just glad that it's gotten merged. I really appreciate the work that you've put into making libraries accessible. It's definitely helped me be able to accomplish some of my goals in my projects. I realize that I probably should have included some changes to the README as part of this PR to explain the functionality. I'll try to submit another PR for that soon.

morpheus7CS commented 2 years ago

Hey @chewbakartik,

I plan on modifying the API slightly with @aweCodeMan this week, so you can leave it and I'll take care of the documentation.

Thanks! g

chewbakartik commented 2 years ago

Sounds good!