1

I am following this: https://laravel.com/docs/5.3/elixir

Here is my gulpfile.js:

elixir(mix => {
    mix.webpack('app.js')
    .styles([
        'bootstrap.min.css',
        'agency.css',
        'font-awesome.min.css',
        'bootstrap-social.css',
        'bootstrap-datetimepicker.min.css',
        'select2.min.css',
        'icheck.css',
        'custom.css'
        ])
    .scripts([
        'jquery.easing.min.js',
        'jqBootstrapValidation.js',
        'agency.min.js',
        'moment.js',
        'bootstrap-datetimepicker.min.js',
        'select2.min.js',
        'contact_me.js',
        'icheck.min.js',
        'ckeditor.js',
        'echo.js',
        'custom.js'
    ])
    .version(['css/all.css', 'js/all.js']);
 });

Here, I'm simply merging all css and js files into two files: all.css and all.js to minimise HTTP request(to improve performance)

Those two merged files, getting stored at

public/build/css/all-5ba9458ba4.css
public/build/js/all-1723826a20.js

And I'm including them into templates like:

<link rel="stylesheet" href="{{ elixir('css/all.css') }}">
<script src="{{ elixir('js/all.js') }}"></script>

The issue here is that those combined css and js i.e all.css and all.js getting stored inside of "build" directory.

So, I need to move other related dependencies (like fonts) inside that build directory.

So, what is the solution over here?

Any help would be appreciated.

Thanks,

Parth vora

3 Answers 3

1

Elixir's version method allows you to set a path I believe

mix.version(['css/all.css', 'js/all.js'], 'public');

Then use

elixir('path/to/script.js', null) // note the null

In your case

<link rel="stylesheet" href="{{ elixir('css/all.css', null) }}">
<script src="{{ elixir('js/all.js', null) }}"></script>
Sign up to request clarification or add additional context in comments.

2 Comments

no it didn't worked. There is no such second parameter for mix.version() laravel.com/docs/5.3/elixir#versioning-and-cache-busting
It's undocumented- See here. Looking at that code suggests you could also set public.versioning.buildFolder in your elixir config
0

This should work:

mix.version(['style.css', 'script.js'], 'public');

https://laravel.com/docs/5.3/elixir#versioning-and-cache-busting

Comments

0

As per this documetation, I think there is no such option to provide custom path for version method.

https://laravel.com/docs/5.3/elixir#versioning-and-cache-busting

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.