szwagros's avatar

Mix.js output path

Hi,

why this works :

mix.sass('resources/assets/sass/admin.scss', '../resources/assets/build/admin.css');

it stores compiled admin.css in /resources/assets/build/admin.css

but this

mix.js('resources/assets/js/admin.js','../resources/assets/build/admin.js');

will create full path to admin.js and store it in public folder e.g.;

/public/storage/Code/projects/hash/public/home/vagrant/Code/projects/resources/assets/build/admin.js

How can I compile js file using mix.js into /resources/assets/build/ directory ?

0 likes
3 replies
Jaytee's avatar

@developer11 Off

You don't compile your files into the resources/assets directory. If you do, they won't be accessible meaning your CSS and JS won't load.

That's the point of the public folder being named public. You compile your assets to the public folder.

szwagros's avatar

@Jaytee

Yes I'm aware that css i js should finally end up in public dir. As a matter of fact that is what I'm doing later in webpack.mix.js:

mix.scripts([ 'node_modules/admin-lte/bower_components/jquery/dist/jquery.js', 'node_modules/admin-lte/bower_components/bootstrap/dist/js/bootstrap.js', 'node_modules/admin-lte/bower_components/fastclick/lib/fastclick.js', 'node_modules/admin-lte/bower_components/select2/dist/js/select2.full.js', 'node_modules/admin-lte/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js', 'resources/assets/build/admin.js'

],'public/js/admin.js');

I just want some intermediate step - first compile with mix.js then combine files with mix.scripts.

I'm just curious why with sass and css it works but not with js.

Please or to participate in this conversation.