如何从 Laravel 5.4 中正确删除 Bootstrap?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42214712/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to remove Bootstrap correctly from Laravel 5.4?
提问by Giregar
I try to start a Laravel 5.4 project without Bootstrap.
我尝试在没有 Bootstrap 的情况下启动 Laravel 5.4 项目。
After installing Laravel, I edited the following files:
安装 Laravel 后,我编辑了以下文件:
resources/assets/js/app.js
资源/资产/js/app.js
require('./bootstrap');
package.json
包.json
...
"devDependencies": {
"axios": "^0.15.3",
"bootstrap-sass": "^3.3.7",
"jquery": "^3.1.1",
"laravel-mix": "^0.7.2",
"lodash": "^4.17.4",
"vue": "^2.1.10"
},
...
I've got the following error:
我有以下错误:
ERROR Failed to compile with 1 errors error in ./resources/assets/js/app.js
SyntaxError: /Users/.../package.json: Error while parsing JSON - Unexpected end of JSON input at JSON.parse () @ multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss
错误 ./resources/assets/js/app.js 中的 1 个错误错误无法编译
SyntaxError: /Users/.../package.json: Error while parsing JSON - Unexpected end of JSON input at JSON.parse () @ multi ./resources/assets/js/app.js ./resources/assets/sass/应用程序.scss
Any suggestions?
有什么建议?
回答by Dunsin Olubobokun
By default, Laravel 5.4 ships with Bootstrap and Vue.js scaffolding, but not everyone wants to use either of those technologies. With Laravel 5.5 you can run this if you don't want any scaffolding to be generated out of the box by Laravel:
默认情况下,Laravel 5.4 附带 Bootstrap 和 Vue.js 脚手架,但并不是每个人都想使用这两种技术中的任何一种。在 Laravel 5.5 中,如果您不希望 Laravel 开箱即用地生成任何脚手架,则可以运行它:
php artisan preset none
回答by Frank Provost
The line
线
require('./bootstrap')
has nothing to do with "Bootstrap" in terms of the libary. You will find the bootstrap.js file that is loaded within your assets. Within this file your application (front-end) is being "bootstraped". If you want to remove Bootstrap form your project you should
就库而言,与“引导程序”无关。您将找到在您的资产中加载的 bootstrap.js 文件。在此文件中,您的应用程序(前端)正在“引导”。如果你想从你的项目中删除 Bootstrap,你应该
- remove it from package.json
- remove dependencies within your app layout
- remove loading of sources from app.js / bootstrap.js
- 从 package.json 中删除它
- 删除应用程序布局中的依赖项
- 从 app.js / bootstrap.js 中删除源加载
回答by Derrick Graham
If you run "npm install" in the command line, bootstrap's sass files will be downloaded. Running "npm uninstall bootstrap-sass" afterwards will get rid of them.
如果在命令行中运行“npm install”,将下载引导程序的 sass 文件。之后运行“npm uninstall bootstrap-sass”将摆脱它们。