2 months ago

custom.js to be required or chained on mix?

Posted 2 months ago by Mikegk


I just want to include a javascript file (which also contains jquery) to the compile list of mix. For my understanding there are at least two ways for that.

  1. Chaining the file to the mix Object like so:
mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css');
  1. Adding an require Command to app.js like so:

Is this correct? I would like to have one mixed file. Chaining doesn't really work since its making a new file.

How do you do it - what are common ways to include / mix custom javascript Code? I would not put the file into the public/ directory to access it there manually. If there is a way to compile and "uglify" the code, it would be perfect.

Please sign in or create an account to participate in this conversation.