Bit of a "first steps" question this one.
I am working on a project that uses gulp, and have found a nice vue component that I would like to incorporate.
I have been recommended to use Laravel mix, but will installing mix mess up the current installation ?
Is there a good way to use vue with gulp ? is doing this "safer" than running gulp and laravel mix ?
Related
I am using laravel 7. How can I use Babel with mix.combine ?
I can find something in the docs but only mentions vue and react automatically using Babel?
I am used tot Gulp and not Webpack. With Gulp I just use it for converting es6 to es5.
Laravel mix is a wrapper around webpack, so using gulp isn't configureable
Seeing as your setup isn't doing much, I would swap to using webpack
I have started my first laravel project after I got a recommendation to use a framework.
I have started watching some tutorials and am trying to follow along, but in all the tutorials there is an assets folder inside resources with for example a _variables file. I don't have this folder, I guess it because I am using laravel version 7x and the tutorials are using an older version? I also thought bootstrap was provided with laravel, but it does not work. Have I done anything wrong or does everything seem right? I have followed a tutorial step-by-step from the start and used npm install & npm run dev, but the css file it creates is empty. I have also tried to start over with a new project, but the same happens!
Any help is appreciated!
Are you already run composer require laravel/ui? Laravel 7 has frontend scaffolding. You can read the documentation's about frontend scaffolding here https://laravel.com/docs/7.x/frontend.
Hope this help.
I am not new to Laravel but am new to JavaScript frameworks.
I want to use React in a laravel build but cannot find any information on how to do this.
I have Laravel 5.4. I know this comes pre-packed with Vue and Laravel Mix instead of Gulp.
I am following the tutorial here: https://blog.tighten.co/adding-react-components-to-a-laravel-app but this is not meant for 5.4. It mentions needing to update the gulpfile but, since Laravel 5.4 doesn't use Gulp, there isn't one!
Can someone please help with a small tutorial or a couple of steps that I need to replicate in order to get React working in 5.4?
I have Googled but can only find NPM links, which are less than useful!
Thanks to Joe for pointing out the part of the docs that I needed. There was a little more to it so will describe my steps below to help anyone else out.
Delete the node_modules folder. This isn't necessary for brand new builds but if you have followed any other tutorials and installed things you don't need, this will save a few headaches. If you don't have a node_modules folder, ignore this step.
Please note that the above step will remove anything you have installed using NPM.
Run npm install from your project root. This will install all NPM components used by Laravel.
Open webpack.mix.js and change:
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css');
to
mix.react('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css');
Run npm run dev to compile the Javascript from the lesson contained in the question above. Your React JS outputs should now be working.
(optional) Use npm run watch to compile on the fly.
I really hope this helps someone else out as much as it helped me!
According to the docs, React support is built in to Mix:
Mix can automatically install the Babel plug-ins necessary for React support. To get started, replace your mix.js() call with mix.react():
mix.react('resources/assets/js/app.jsx', 'public/js');
Behind the scenes, Mix will download and include the appropriate babel-preset-react Babel plug-in.
I'm not 100% sure whether or not this'll automatically include React in your output bundle - my guess would be no (in which case you'll have to use a normal mix.js() call to pull it in).
This problem is driving me mad, I have been researching and have read about the standalone and runtime version of Vue. As far as I can tell Laravel 5.4/homestead ships with the standalone version as default.
The Vue development tools in chrome show the example component so I think that part is working correctly, just cannot render the template.
I am relatively new to Vue and npm been stuck in the past with jQuery, firstly where in laravel can I check/set I want the stand alone version of Vue? If it is not that problem does any one have any ideas?
Thanks for help
VueJS supports two ways of building apps like you said.
Load all necessary scripts within your page via script tags (not combined .vue files).
Compile and bundle all your files with Gulp, Browserify, Webpack or other tools.
Can you explain what you did so far. I guess you don't compile everything down.
The comment by peaceman was the solution, I had multiple calls to elixir, I condensed down to one and it worked straight away. Thanks everyone for your help.
I've tried everything I've found to setup laravel 5.3 with elixir + webpack + vue + hot module reload and I can't achieve it.
When I do gulp watch I can't run the webpack dev server with hot module reload. I've searched for a solution for a few days and I haven't found anything.
Do you know how to set it up?
I've just been trying to figure this out myself and discovered the new replacement for Elixir: Mix. I've just installed it on an existing Laravel 5.3 app and I now have HMR with webpack. See the instructions to install it here: https://github.com/JeffreyWay/laravel-mix/tree/master/docs
Hope this helps
https://laracasts.com/discuss/channels/vue/how-to-elixir-vue-browsersync-vueify-hotreload
Since elixir does a lot of magic behind the scene, it can be tricky to add something like vueify hot reload.