question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Laravel mix outputs the compiled assets in wrong directory

See original GitHub issue
  • Laravel Mix Version: 6.0.43
  • Node Version: v16.15.0
  • NPM Version: 8.5.5
  • OS: Windows 10

Description:

webpack.mix.js file:

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

mix.sass('resources/sass/auth.scss', 'resources/css').options({
    processCssUrls: false
});

auth.scss file:

body {
    background-color: #fff;

    a, a:hover {
        color: green;
    }
}

The output of the auth.css file should be resources/css/auth.css. Instead it’s public/resources/css/auth.css.

However, the mix-manifest.json file outputs the corect path:

{
    "/resources/css/auth.css": "/resources/css/auth.css"
}

Steps To Reproduce:

Check above.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
kokoshnetacommented, May 25, 2022

It’s not just relative to the public path – it does absolutely everything, including chopping up paths and ignoring them entirely, to keep the output within the public path. Even something like css/../../resources is treated like public/resources.

This is an issue that has been reported many times here, never with an answer. It seems there is just no way to get Mix to interact with anything outside the public folder in any way, at all, ever, under any circumstances, except as an input path.

Going by earlier threads, it seems it used to be possible to copy or combine files outside the public path – but that’s no longer the case, so you can’t even copy a processed file to your resources folder anymore.

It is, plainly put, bewilderingly stupid. Of course the public folder should be the default output for processed assets; but saying that nothing processed can ever be placed anywhere but in the public folder under any circumstances is beyond opinionated, it’s plain wrong.

0reactions
lorventcommented, Jul 12, 2022

@akaDJon I use either gulp, webpack or simple CLI scripts in package.json file, all depending on the project.

do you have any start kit for gulp? i am really want to use one but copying assets from node_modules to public folder…this has become my main issue, i can’t find a proper gulp package which can do that.

if you developed any starter-kit kind, please share.

thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - Laravel-mix output path is outputting two different ...
mix file exists, so I had to do some changes first: Inside 'node_modules/laravel-mix/src/Paths. js' I changed the mix() function like this:
Read more >
Mix compiling assets to the wrong directory after modifying the ...
I have modified the paths in the index.php file and the app works as intended now. The problem arises when I try to...
Read more >
Compiling Assets (Mix) - The PHP Framework For Web Artisans
If you've ever been confused and overwhelmed about getting started with webpack and asset compilation, you will love Laravel Mix.
Read more >
Compiling Assets (Laravel Mix)
Русская документация Laravel 5.6 - Compiling Assets (Laravel Mix) ... own respective CSS files and even customize the output directory of the resulting...
Read more >
The Mix API | Laravel Mix Documentation
You can customize the output of the extraction using the output param. ... Set the path to where all public assets should be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found