Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel + Tailwind = font files not loading #163

Closed
ghost opened this issue Feb 22, 2021 · 5 comments
Closed

Laravel + Tailwind = font files not loading #163

ghost opened this issue Feb 22, 2021 · 5 comments
Labels
bug Something isn't working stale

Comments

@ghost
Copy link

ghost commented Feb 22, 2021

I am using Laravel 7 and Tailwind, with Laravel Mix (6.0.0-beta.17) to compile. I've added a font via fontsource, but the actual font files 404.

If I manually move the missing files to the public/css/files directory, everything works fine.

Here is my webpack.mix.js file:

mix.js('resources/js/app.js', 'public/js')
    .js('resources/js/footer.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css')
    .options({
        processCssUrls: false,
        postCss: [
            tailwindcss('tailwind.config.js'),
        ]
    })
    .vue();

I think it may have something to do with the .options, but if I remove them, my Tailwind doesn't compile and my CSS breaks.

Can anyone point me in the right direction? Thank you!

@ghost ghost added the bug Something isn't working label Feb 22, 2021
@ayuhito
Copy link
Member

ayuhito commented Feb 23, 2021

I have a feeling that this is an issue with Laravel Mix not resolving the CSS file font files properly. I've seen other bundlers not account for this previously and push fixes when their relevant users report it.

An alternative clear solution to this is also #133 which is an open issue.

@stale
Copy link

stale bot commented Apr 24, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
Use the 'not stale' label to prevent the issue from automatically closing.

@stale stale bot added the stale label Apr 24, 2021
@stale stale bot closed this as completed May 8, 2021
@Lloydinator
Copy link

Lloydinator commented Jun 7, 2021

I'm having this problem right now. Does anyone have any tips?

@ayuhito
Copy link
Member

ayuhito commented Jun 7, 2021

I'm having this problem right now. Does anyone have any tips?

@Lloydinator, could you try setting processCssUrls to true in the options() section of webpack.mix.js?

The reason why the fonts are 404ing is due to the CSS URLs not processing correctly. However, I'm not sure if that breaks another part of your build like Tailwind.

@austriker27
Copy link

I'm having this problem right now. Does anyone have any tips?

@Lloydinator, could you try setting processCssUrls to true in the options() section of webpack.mix.js?

The reason why the fonts are 404ing is due to the CSS URLs not processing correctly. However, I'm not sure if that breaks another part of your build like Tailwind.

Im getting this issue with a project that uses laravel mix and sadly processCssUrls: true, does not fix the incorrect font file paths

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

3 participants