简体   繁体   English

通过Bower安装软件包

[英]Install packages via Bower

I'm new to front-end technologies, but I need to install a package via Bower. 我是前端技术的新手,但我需要通过Bower安装软件包。 Here is the package: https://github.com/collab-project/videojs-record 这是软件包: https : //github.com/collab-project/videojs-record
The thing is that after I installed all dependencies, I obtain a folder with 219.9 MB of dependencies and so on. 问题是,在安装所有依赖项之后,我将获得一个包含219.9 MB依赖项的文件夹,依此类推。 All this folders are situated in /public/videojs-record directory of my Laravel project. 所有这些文件夹都位于我的Laravel项目的/public/videojs-record目录中。 So, I can connect all .css and .js files like in documentation of package. 因此,我可以像包装文档中那样连接所有.css.js文件。 These files are 4 times bigger than my entire project and they are situated in the public folder, that has to slow down my website, yep? 这些文件比我的整个项目大4倍,它们位于公共文件夹中,这会使我的网站变慢,是吗?
How can I move that dependencies out of the public folder, for example in /vendor directory of my project, and connect this .css and .js files in my HTML? 如何将该依赖关系移出公用文件夹(例如,在项目的/vendor目录中),并在HTML中连接此.css.js文件?

As already mentioned in the comments, there is no need to use Bower. 正如评论中已经提到的那样,无需使用Bower。 Just use NPM as mentioned in the doc of said package. 只需使用上述软件包文档中提到的NPM。

Laravel comes already with a package.json and a webpack configuration. Laravel已经带有package.json和webpack配置。 The normal way to add frontend dependencies is: 添加前端依赖项的通常方法是:

  1. Install all Laravel basic fe dependencies 安装所有Laravel基本fe依赖项

    $ npm install

  2. Install a external package 安装外部套件

    $ npm install videojs-record

  3. Built the packages for development 构建开发包

    $ npm run dev

    Running a watcher 运行观察者

    $ npm run watch

    Built the packages for production 构建用于生产的包装

    $ npm run prod

The dependencies will be stored in node_modules . 依赖关系将存储在node_modules This folder can get very huge but you don't commit it to GIT or push it to the server manually. 该文件夹可能会非常大,但是您不会将其提交到GIT或将其手动推送到服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM