is there any proper way to integrate swiper in laravel? - laravel

I looking for solution which can describe integration of swiper in Laravel. I searched on internet but didn't find any proper way to integrate swiperjs carousel in Laravel.
I use npm install swiper but don't know how to call it?

Use CDN script is best option than to install locally sipperJs vie npm
use CDN scripts of swipperJs
put CDN script in tag in layout.blade or index.blade in view directory
keep JS in public/js
keep CSS in public/css
add swiperJS layout in index.blade
slider will run....
if not run then maybe if any js script comficting it.
ps: no need to use other solutions like
var Swiper = require('swiper');
import Swiper from 'swiper';

Related

vue does not display .svg file in local env

I am making some project with Laravel, Vue2 now.
I deployed my project onto the test server, there .svg files display, but in my local environment they don't display.
I use :src="asset('images/ico_arrow_left1.svg')" in vue component.
My images and svg files are all in root/public/images folder.
For example; I wrote the following code to display svg in vue component.
<a #click="previousDay"><img class="ico_ico_arrow" :src="asset('images/ico_arrow_left1.svg')"></a>
The codes are sampe in test server and local.
show in test server, but not show in local, why?
If you want import a file from public folder you should check the documentation. You should use require when you import dynamic asset. Like this:
<img class="ico_ico_arrow" :src="require('images/ico_arrow_left1.svg')"/>
The asset() helper function is only for the Laravel Blade template. you can't use it inside of a regular Vue application.
In Vue, you should use require()in order to solve this problem.

Live Edit in PhpStorm for Laravel projects

I like to use Live Edit feature, however, it seems to me it only works with regular .html files, however, none of the known to me ways work with Laravel .blade.php files. Google didn't answer.
Is there really no way to do so?
For Laravel projects, you can use BrowserSync to automatically refresh websites when you make changes to your template files. Support for BrowserSync comes out of the box with Laravel Mix. To use this feature, all you have to do is go to your webpack.mix.js file and add the mix.browserSync() function call. If you're using Laravel Valet or something similar to get pretty URLs, you can pass in a URL as an argument to proxy.
mix.browserSync();
// OR
mix.browserSync('my-domain.test');
Documentation: Compiling Assets (Mix)

How to use React Bootstrap with Laravel

I'm currently using Laravel 5.6. I have integrated bootstrap and would like to use the package React Bootstrap. For my component building.
Currently the components do not render properly. I believe it's because it's conflicting with the Laravel bootstrap/
In app.js I've disabled:
// require('./bootstrap');
The component still does not appear correctly.
I also import this in my component:
import 'bootstrap/dist/css/bootstrap.min.css';
This causes my layout to change drastically.
Is there any specific way I can up my laravel project and be able to take advantage of the React Bootstrap components?
you should run npm install && npm run dev commands and then it will work properly
this is the link from documentation https://laravel.com/docs/7.x/frontend
you can try adding bootstrap cdn on your blade file

React app on deployment server

I have an Ubuntu VPS with Laravel v5.6 served with nginx, and I am trying to use React on the front-end. I don't know if this is possible what I want to do is:
use node and npm to build my front-end app locally,
generate the CSS and JS files and upload those already generated files to my VPS server,
the output should not change since as far as I know npm generates at JS and CSS files with your whole code in it
Thanks for the help, and if there is any suggestion for a different approach just let me know.
You should start to use a frontend bundling solution like webpack or parcel, they do exactly the same
If you generate your app with create-react-app it comes with webpack built-in

Webpack getting started with Laravel. How to setup workflow?

I am currently using Webpack with Laravel to manage dependencies on a new project. My current workflow looks like this:
npm install whatever-package
require('whatever-package'); (in frontend.js)
GulpFile.JS >
elixir(mix => {
//the core scss file. contains bootstrap and vendor stuff.
mix.sass('frontend.scss')
.webpack('frontend.js');
}
run gulp
Frontend.js is then included in my PHP template. This would work great for a single page application, but if I want to have one javascript file, and multiple web pages what technique should I be using to pull in javascript for other pages?
Should I have multiple JS files all webpacked with Elixir? Or what is the next step to require in the right files?
i.e. does Webpack support a single entry point where I can start to load other scripts via data attributes? I've used this technique with requireJS previously, and just trying to wrap my head around the best way to do this with Webpack.

Resources