In my Laravel project I have a number of javascript files and a number of coffeescript files. They're stored in the following structure:
resources/assets/js/jquery.min.js
resources/assets/js/jquery.form.js
resources/assets/coffee/main.coffee
What I would like to do using Laravel Elixir and Gulp, is to compile the coffeescript file into Javascript, and combine all 3 Javascript files into a single file and output it:
public/js/main.js
My problem seems to be that mix.scripts()
only likes javascript files whereas mix.coffee()
only seems to like coffeescript files, so I'm finding it difficult getting the output I need.
I'm sure I could achieve this in a "hacky" way by running mix.coffee()
on my coffeescript and then running mix.scripts()
on the resulting file and the other two Javascript files but I was hoping there would be a better way to achieve this.
elixir(function(mix) {
mix.scripts([
'jquery.min.js', 'jquery.form.js'
], 'public/js/main1.js');
mix.coffee([
'main.coffee'
], 'public/js/main2.js');
});