Framework: [6.0] Scaffold Auth

Created on 28 Aug 2019  路  10Comments  路  Source: laravel/framework

A good reference first is:

https://laracasts.com/discuss/channels/laravel/laravel-60-appcss

The docs state:

In fact, you don't have to use JavaScript at all.

Yet to scaffold Auth you have only two choices:

php artisan ui vue --auth
or
php artisan ui react --auth

I of course do use JS, I use jquery.
It generated everything when I ran

php artisan ui vue --auth

I did run composer require laravel/ui first, However in app.blade.php it has:

<link href="{{ asset('css/app.css') }}" rel="stylesheet">

But no where is the file app.css found. Where is app.css supposed to come from.

Most helpful comment

I don't understand the answer. I was referring to npm now being required for authentication scaffolding yet it never was before. And I referenced the docs already, so just wondering, re-referring me to the docs, what does that mean.
If Taylor has decided, "Hey we are going to make npm required", then just say that.

If you feel that this can be explained better than feel free to send in a PR.

I never asked for an explanation, I was asking to "not make npm" required to scaffold and use authentication.

All 10 comments

The public/css/app.css file is a compiled file. If you use a different convention or asset storage scheme, just replace this with the css file you use.

As I said

app.blade.php is calling for this file.

<link href="{{ asset('css/app.css') }}" rel="stylesheet">

I don't care if it's compiled, but the docs clearly State you can scaffold Auth, but does not say you have to compile a file yourself for Auth login to have style.

Npm has never in the past been a requirement to use laravel and never been required for basic out of box styles for login and register.

Are you saying I need to somehow find the app. css file from somewhere then I have to install npm, then compile that one file only to have styling for login.

Also there is no public/css/app.css file included in ver 6.0.

Perhaps this could be fixed before the final release.

You don't have to do anything. That scaffolded file is generated to help you get started. It uses the more common conventions among laravel developers. You're free to edit that file to fit whatever your convention is. Personally, I change it every time I scaffold auth.

Also, the docs are open source. If you think it could be more clear, feel free to send a PR.

Here is the main question. Where is app.css. I think you might have missed that point, nowhere to be found is an app.css.

Fyi I've used laravel since 4.2 I know I can override anything.

The issue is there is a missing file. app.css.

Thanks for your help.

It's best to take this to one of the community forums.

You create it. It doesn't exist.
The most common convention for frontend assets in Laravel is to use laravel mix or a bundle of some sort, that bundles your styles into public/css/app.css and your scripts into public/js/app.js.
Check out the laravel docs on assets. https://laravel.com/docs/5.8/mix

This is a 6.0 issue, 5.8 has no issue with a missing app.css file. Trying to get this stuff fixed before final release to help people.

See my original post above I reference a link in the community forum.

As a work around I downloaded bootstrap css, named app.css and of course that works. But if after scaffolding

<link href="{{ asset('css/app.css') }}" rel="stylesheet">

You have this in a created file, shouldn't app.css exist. Maybe it should be there and there's an error in the scaffold command, but it should at least be checked.

Well I deleted all and tried again, and after running:

php artisan ui vue --auth

I noticed the message:

Please run "npm install && npm run dev" to compile your fresh scaffolding.

So I guess the framework now requires npm if you want the out of the box Auth scaffolding.

Yet without installing npm, renaming bootstrap.css to app.css I got all working. Is this just a way to force newcomers to the framework who may not know a work around to have to install npm, and have to compile assets.

Up to now since version 4.2 nothing has even been forced on you. Maybe forced isn't the best word here, but all I can think of. Why does npm suddenly appear to be required, when a small app with custom css and a small amount of jquery does not need compiled.

I still think of it as an issue, it appears to remove flexibility all previous versions had.

Experienced laravel folks know how to do work arounds, but new comers won't have any idea that there is a work around.

Shouldn't the app.css still be there like previous versions without requiring npm to compile only one file.

Everything is explained here: https://laravel.com/docs/6.0/frontend#writing-css

If you feel that this can be explained better than feel free to send in a PR.

I don't understand the answer. I was referring to npm now being required for authentication scaffolding yet it never was before. And I referenced the docs already, so just wondering, re-referring me to the docs, what does that mean.
If Taylor has decided, "Hey we are going to make npm required", then just say that.

If you feel that this can be explained better than feel free to send in a PR.

I never asked for an explanation, I was asking to "not make npm" required to scaffold and use authentication.

Just to give you some support. That`s the commit in which the app.css is removed: https://github.com/laravel/laravel/commit/fc39b073f3f61a22f1b48329e294ebb881700dbe
Maybe the others will now better understand what you mean.
I also have have to say this doesn't look like a bug but rather like a question, so it doesn't fit in here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lzp819739483 picture lzp819739483  路  3Comments

ghost picture ghost  路  3Comments

JamborJan picture JamborJan  路  3Comments

kerbylav picture kerbylav  路  3Comments

iivanov2 picture iivanov2  路  3Comments