rmobayen's avatar

laravel ui vue/bootstrap

Hello everybody!

I am trying to use Vuejs without bootstrap. based on the documentation I can pick either of both, even each one has its own artisan command! BUT both artisan commands (Vue and bootstrap) are doing exactly the same! I've run (artisan ui vue --auth) and it installed bootstrap and jquery as well as Vuejs

I know I can uninstall them manually but i want to know is that the way it is supposed to work? Did I missed something?

0 likes
19 replies
Nakov's avatar

@rmobayen if you mean the line

require('./bootstrap');

includes bootstrap then that's not true, it just loads the bootstrap.js file within the resources/js folder which just requires axios and loadash by default, and sets the token to axios.

In Laravel < 6 you could run php artisan preset none which will delete the frontend, but in the new versions is as you said you need to install the package manually and run the ui vue --auth artisan command.

And except for the ExampleComponent that uses bootstrap classes, but if you mount it to the view you'll see it will be broken :) the bootstrap is not loaded by default anymore.

Let me know if this clears things up. I just tried the steps on a fresh project to make sure.

1 like
ciungulete's avatar

Check your package.json file. If you find jquery or bootstrap there remove it. Then delete node_modules folder and after that run npm install

1 like
rmobayen's avatar

thanks for the response No, I am referring to the actual bootstrap and jQuery! they actually get installed and show up in the "package.json"

I know I can just not use them and/or remove them manually, but dont these artisan commands supposed to install just vue, but not bootstrap/jquery??

rmobayen's avatar

yes, it's an option and I did this already! but i wonder is there a cleaner way to do so?

Nakov's avatar

@rmobayen are you sure you are running a completely new install?

This is the package.json that comes out on a fresh install:

https://github.com/laravel/laravel/blob/master/package.json

So there is no bootstrap nor jQuery, as I said above, I installed it now also on my machine, and I don't see any bootstrap nor jQuery reference, even after installing the laravel/ui package.

Here is the Vue preset:

https://github.com/laravel/ui/blob/1.x/src/Presets/Vue.php

which again doesn't seems to add the Bootstrap nor jQuery.

Please run php artisan --version and make sure you are running Laravel version > 6. Otherwise use php artisan preset none to get the presets off :)

rmobayen's avatar

have you installed the laravel/ui package?

and then these:

...
// Generate login / registration scaffolding...
php artisan ui bootstrap --auth
php artisan ui vue --auth
...
Nakov's avatar

@rmobayen I did installed the laravel ui package.. but I just installed this:

php artisan ui vue --auth

So of course if you installed:

php artisan ui bootstrap --auth

that will add both bootstrap and since bootstrap depends on jQuery it will install jQuery too.

You should install one of those you are not required to install all of them my friend :)

rmobayen's avatar

update so here it is: it is not an option the vue scaffolding command php artisan ui vue install the "bootstrap" preset and then "vue" so I guess the only thing should be done is uninstall bootstrap and jQuery!!

https://github.com/laravel/ui/blob/1.x/src/UiCommand.php#L71
rmobayen's avatar

I think there is a misunderstanding!

  1. if you run just the first command php artisan ui vue --auth, but not the second command php artisan ui bootstrap --auth you will have both bootstrap and jquery in your dependencies! right?

I know I am not required to do so! and I know I can remove them manually later

my question was: is it supposed to be that way or I did missed something? or in another word: is there any cleaner way to install only VueJS??

which the answer seems to be "NO"!

Nakov's avatar

Yeah, you are right. I don't know what happened then, I really just installed a fresh project, ran the

composer require laravel/ui --dev

then:

php artisan ui vue --auth

but then I just tried

php artisan preset none

maybe that deleted something, but anyway the Vue is here, and I don't see any Bootstrap nor jQuery.

jlrdw's avatar

Just install vue then. Presets are meant to be modified as needed.

Quote

However, feel free to add or remove packages from the package.json file as needed for your own application.

Unquote

That quote is from Taylor directly in the documentation.

To scaffold authentication read that chapter.

rmobayen's avatar

correct, and you dont have Vuejs either. that means your node packages are the same as before!

technically you have installed them and then uninstalled!

rmobayen's avatar

right I am aware of that dude! that called manually remove them!

jlrdw's avatar

Are you under the belief that when package.json is generated all that is installed.

No all of that stuff in package. Json is not installed at that time.

You are to modify it to suit your needs before you install anyting else.

rmobayen's avatar

@nakov it is strange! because I did exactly what you have listed above, but everything, including vuejs, is gone after the last command

rmobayen's avatar

@jlrdw no i dont believe that. but I think you missed what I've asked

Nakov's avatar

@rmobayen if Vue is gone, then run php artisan preset vue :) it will be back, just Vue.

I have this in my package.json

"devDependencies": {
        "axios": "^0.19",
        "cross-env": "^5.1",
        "laravel-mix": "^4.0.7",
        "lodash": "^4.17.13",
        "resolve-url-loader": "^2.3.1",
        "sass": "^1.20.1",
        "sass-loader": "7.*",
        "vue": "^2.5.17"
    }
1 like
rmobayen's avatar

@nakov thanks.

thanks to all friends that responded, I appreciate that the responses helped a lot guys!

Please or to participate in this conversation.