日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

php npm,php – Laravel中NPM,Composer和Bower的区别?

發布時間:2023/12/10 php 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php npm,php – Laravel中NPM,Composer和Bower的区别? 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

所以在Laravel有Composer,NPM和Bower,我知道他們都是deoendancy經理.

Composer – 這似乎關注PHP依賴關系,包列表是composer.json的內容控制器.要安裝軟件包,您可以添加到此文件或運行php composer install< package>.

NPM – 這似乎專注于JavaScript依賴,但也有一個瘋狂的包. npm install安裝的軟件包由package.json文件的內容決定.

鮑爾 – 據我所知,這是針對前端套餐的?

如果你愿意,你可以在Laravel中使用所有這三個,但是如果通過npm和composer這兩個庫可用,你為什么要使用另一個?

例如,在Laravel的安裝中,它們有兩個文件:

> app.js – 應用程序的主要js文件

> bootstrap.js – app.js中包含的文件,用于引入某些依賴項

這是我在resources / js中的bootstrap.js的內容

window._ = require('lodash');

window.Popper = require('popper.js').default;

/**

* We'll load jQuery and the Bootstrap jQuery plugin which provides support

* for JavaScript based Bootstrap features such as modals and tabs. This

* code may be modified to fit the specific needs of your application.

*/

try {

window.$= window.jQuery = require('jquery');

require('bootstrap');

require('slick-carousel');

require('isotope-layout/dist/isotope.pkgd.min.js');

require('tablesorter/dist/js/jquery.tablesorter.combined.min.js');

}

catch (e) {}

/**

* We'll load the axios HTTP library which allows us to easily issue requests

* to our Laravel back-end. This library automatically handles sending the

* CSRF token as a header based on the value of the "XSRF" token cookie.

*/

window.axios = require('axios');

window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

/**

* Next we will register the CSRF Token as a common header with Axios so that

* all outgoing HTTP requests automatically have it attached. This is just

* a simple convenience so we don't have to attach every token manually.

*/

let token = document.head.querySelector('meta[name="csrf-token"]');

if (token) {

window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;

} else {

console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');

}

/**

* Echo exposes an expressive API for subscribing to channels and listening

* for events that are broadcast by Laravel. Echo and event broadcasting

* allows your team to easily build robust real-time web applications.

*/

// import Echo from 'laravel-echo'

// window.Pusher = require('pusher-js');

// window.Echo = new Echo({

// broadcaster: 'pusher',

// key: process.env.MIX_PUSHER_APP_KEY,

// cluster: process.env.MIX_PUSHER_APP_CLUSTER,

// encrypted: true

// });

在app.css我有這個:

/*

* This file takes all of the styling we need and compiles it into one nice CSS file.

* You'll notice you can pull in anything from the node_modules folder use a Tiddle (~)

*/

@import '~bootstrap/dist/css/bootstrap.min.css'; // Bootstrap 3.3.7 CSS

@import '~slick-carousel/slick/slick.css'; // Slick Carousel base CSS

@import "variables"; // Sass Variables

@import "partials/typography"; // All from this point are from the partials folder

@import "partials/mixins";

@import "partials/helpers";

@import "partials/navigation";

@import "partials/breadcrumb-bar";

@import "partials/welcome-box";

@import "partials/form-box";

@import "partials/content-box";

@import "partials/carousels";

@import "partials/tables";

@import "partials/interactions-row";

@import "partials/downloads-area";

@import "partials/articles-events";

@import "partials/biography-pages";

@import "partials/grid";

@import "partials/footer";

@import "partials/steve-custom.scss";

實際上真正拋棄我的是:app.js怎么知道我在node_modules文件夾中引用文件夾,app.css怎么知道我只是通過使用?來引用Bootstrap?

為什么我不必指定絕對路徑?

一般的經驗法則是,JavaScript相關項通常來自npm,而PHP依賴項來自作曲家?

我的困惑是因為我正在查看一個名為Laravel Full Calendar的軟件包,它的樣式和JS代碼似乎是通過npm提取的,但它的PHP依賴部分是從Composer中提取的?

這是正常的行為嗎?

我覺得這里有很多問題,但我覺得Laracasts真的沒有解釋這些包管理器的實際用法.

總結

以上是生活随笔為你收集整理的php npm,php – Laravel中NPM,Composer和Bower的区别?的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。