Custom manifest.json name for mix() function (and others related)

Hi, we are building our themes with Sage10 now (switched from ver9) and we really enjoy it. The only thing was that the Bud was not really our thing, so we switched to laravel-mix to compile our assets. The problem is, that the functions included in Sage 10 like mix() or asset() are expecting the manifest.json file, while laravel-mix generates mix-manifest.json file.

We were trying to dig into the implementation, but not really successfuly. Is is possible to get these functions like mix() working with our setup or not really?

Thank you

Hi @erikgreasy ,

Maybe you have already gotten it to work but here is how I did it. I am not sure if it is the “correct” way so any input is welcome.

I copied config/assets.php from Acorn and placed the file in the config folder in the theme. Then changed ‘manifests’ to

    'manifests' => [
        'theme' => [
            'path' => get_theme_file_path('dist'),
            'url' => get_theme_file_uri('dist'),
            'assets' => get_theme_file_path('dist/mix-manifest.json'),
        ]
    ]

This will make the Manifest class in Acorn use the mix-manifest.json file in the dist folder.

Then in app/setup.php, I replaced everything in the function for wp_enqueue_scripts with for example
wp_enqueue_style('app', asset('/styles/app.css')->uri(), [], false, 'all');

Everything seems to work as intended.

1 Like

Hi @folbert ,
After some debugging and searching I came across this config file too. Basically used the same approach as you to get it working. Thank you for helping!