ElpsySec
4 years ago
209
10
General

Combining multiple js files in Assets into one in public

Posted 4 years ago by ElpsySec

I am trying to combine multiple javascript and css libraries into one all.css and one all.js.

The files are located in resources/assets/lib/[libpath]/filename

Here is what I have:

elixir(function(mix) {

mix.sass('app.scss')

   ...

    .styles(['bootstrap.css'], 'public/lib/css', 'resources/assets/lib/bootstrap/dist/css' )

    .scripts(['jquery.js'], 'public/lib/js', 'resources/assets/lib/jquery/dist')

    .scripts(['jquery-ui.js'], 'public/lib/js', 'resources/assets/lib/jquery-ui')

    .scripts(['bootstrap.js'], 'public/lib/js', 'resources/assets/lib/bootstrap/dist/js')

});

As of now, Elixer only seems to be pulling in one script.

I can't use the .scripts([files], 'targetLoc', 'sourceLoc') because the assets are located in different file paths. Am I not allowed to use multiple .scripts()?

Here is my relevant gulp watch output:

[15:58:21] Merging: resources/assets/lib/jquery/dist/jquery.js

[15:58:21] Merging: resources/assets/lib/jquery-ui/jquery-ui.js

[15:58:21] Merging: resources/assets/lib/bootstrap/dist/js/bootstrap.js

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