const mix = require('laravel-mix');

mix.webpackConfig({
    module: {
        rules: [
            {
                test: /\.(woff|woff2|eot|ttf|otf)$/, // Match all font file types
                type: 'asset/resource', // Handle font files as assets
                generator: {
                    filename: 'fonts/[name][ext]', // Output to public/fonts/
                },
            },
        ],
    },
    externals: { 'jquery': 'jQuery' }
});

/*
 |--------------------------------------------------------------------------
 | Default NextBestNetwork skin styles and scripts
 |--------------------------------------------------------------------------
 |
 | Those mix functions are compiling the default scripts and styles for
 | the NextBestNetwork skin. Files compiled from with this mix functions do
 | overwirte the default NextBestNetwork assets. Those files will also be
 | overwritten with any git update from the skin repository.
 |
 * /
mix.js('resources/scripts/nextbestnetwork.js', 'public/default/js')
   .sass('resources/styles/nextbestnetwork.scss', 'public/default/css');


/*
 |--------------------------------------------------------------------------
 | Custom NextBestNetwork skin styles
 |--------------------------------------------------------------------------
 |
 | Those functions are meant to be used for custom assets. If you would like
 | to create your own skin assets create the listed files and use the npm
 | scripts to create custom assets. Custom assets have to be activated
 | from whitin the skin settings to be used by your skin installation.
 |
 | You can rename the given files as follows to have a basic setup for your
 | own skin styles and scripts:
 |
 | - ./resources/scripts/example.custom.js     => ./resources/scripts/custom.js
 | - ./resources/styles/example.custom.scss    => ./resources/styles/custom.scss
 |
 */
mix.js('resources/scripts/custom.js', 'public/custom/js')
   .sass('resources/styles/custom.scss', 'public/custom/css')
   .options({
      processCssUrls: false
   })
   .copyDirectory('resources/fonts', 'public/custom/fonts');

mix.browserSync({ proxy: process.env.MIX_LOCAL_PROXY_URL });

/**/
