dimanche 1 octobre 2017

Laravel mix resource path

I have two Themes in my Laravel app, first one is a default page theme and the second is for the admin panel.

I would like to make separated assets folder for each, so I have created a configuration doing so. JS and CSS files are now landing in the appropriate directories, however I can't figure out how to do the same for fonts/images assets as they still land into my public directory.

What I want is:

Resource files from resources/assets/sass/app.scss to land in the assets/fonts or assets/images.

Resource files for my admin theme from resources/themes/admin/default/assets/sass/app.scss to land in the admin/assets/fonts or admin/assets/images.

How can I achieve this?

My .mix configuration file:

let mix = require('laravel-mix');

mix.setPublicPath('public');
mix.setResourceRoot('../')

mix.js('resources/assets/js/app.js', 'assets/js')
   .sass('resources/assets/sass/app.scss', 'assets/css');

// Admin assets

mix.js('resources/themes/admin/default/assets/js/app.js', 'admin/assets/js')
    .sass('resources/themes/admin/default/assets/sass/app.scss', 'admin/assets/css');

if (mix.inProduction()) {
    mix.version();
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire