sandaur's avatar

Make Laravel Mix resolve JavaScript file references

I'm using a javaScript module that references some files that comes with this module in a css directory. My question is, is it possible to make Laravel Mix resolve somehow the files that this module is trying to use in this javaScript file?

This is what i'm currently doing

mix.styles([
'node_modules/gentelella/vendors/iCheck/skins/flat/green.css',
], 'public/css/votations.css');

mix.js([
    'node_modules/gentelella/vendors/iCheck/icheck.min.js',
], 'public/js/bundle.js');
0 likes
2 replies
jlrdw's avatar

Have you tried to put that JS in with the other JS. Or is the module only looking for it in one certain folder.

that comes with this module

What module, is it a package with install instructions.

1 like
sandaur's avatar

@jlrdw icheck is a jquery plugin that makes a prettier checkbox using some images, those images reside in \vendors\icheck\skins\flat\css\green.png for example. This file is referenced from the icheck.min.js file (to place the image wherever i use the trigger class). So i thought that maybe there would be an option to Laravel Mix(webpack) to pull this file to my public\ directory automatically.

What i ended up doing was copying the file that i needed with mix.copy() but i'm not sure if this is the right approach, surely there is a Webpack configuration to pull the files referred in the javascript automatically, maybe? i don't know

Please or to participate in this conversation.