Laravel app.js 和 app.css 为什么需要使用?我们可以删除那些吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41328218/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 15:00:26  来源:igfitidea点击:

Laravel app.js and app.css why need to use ? Can we removed those?

phptwitter-bootstraplaravellaravel-5laravel-5.2

提问by MD Ashik

I am new learner on Laravel.

我是 Laravel 的新手。

I am using Laravel5.3.But I want Use Bootstrapcssand Js. But Laravel have default app.cssand app.js. Hare app.cssactually BootstrapCSSand also app.jswork like Bootstarp js. But can i delete app.jsand app.cssand can i use custom version Bootstrap CSS& JS?

我正在使用Laravel 5.3。但我想要使用Bootstrap cssJs。但是 Laravel 有默认app.cssapp.js. Hare app.css实际上是Bootstrap CSS并且也app.js像 Bootstarp js一样工作。但是我可以删除app.js并且app.css可以使用自定义版本的 Bootstrap CSSJS吗?

So I need to know why we will be use this two files ?

所以我需要知道为什么我们要使用这两个文件?

回答by Mayank Pandeyz

You can delete them, read the following lines:

您可以删除它们,请阅读以下几行:

CSS

CSS

Laravel Elixir provides a clean, expressive API over compiling SASS or Less, which are extensions of plain CSS that add variables, mixins, and other powerful features that make working with CSS much more enjoyable.

Laravel Elixir 为编译 SASS 或 Less 提供了一个干净、富有表现力的 API,这些 API 是普通 CSS 的扩展,添加了变量、mixin 和其他强大的功能,使使用 CSS 变得更加愉快。

In this document, we will briefly discuss CSS compilation in general; however, you should consult the full Laravel Elixir documentation for more information on compiling SASS or Less.

在本文档中,我们将简要讨论一般的 CSS 编译;但是,您应该查阅完整的 Laravel Elixir 文档以获取有关编译 SASS 或 Less 的更多信息。

JavaScript

JavaScript

Laravel does not require you to use a specific JavaScript framework or library to build your applications. In fact, you don't have to use JavaScript at all. However, Laravel does include some basic scaffolding to make it easier to get started writing modern JavaScript using the Vue library. Vue provides an expressive API for building robust JavaScript applications using components.

Laravel 不需要您使用特定的 JavaScript 框架或库来构建您的应用程序。事实上,您根本不必使用 JavaScript。但是,Laravel 确实包含了一些基本的脚手架,以便更轻松地开始使用 Vue 库编写现代 JavaScript。Vue 提供了一个富有表现力的 API,用于使用组件构建健壮的 JavaScript 应用程序。

Complete Reference

完整参考

回答by Arun Code

Laravel default CSS and JS files are safe to remove.

Laravel 默认的 CSS 和 JS 文件可以安全删除。

However, these styles will be used in the following places by default, so please be taken care of it.

不过这些样式默认会用到以下地方,请大家多多关照。

  1. Default Welcome page
  2. Laravel auth pages
  3. Default error page
  1. 默认欢迎页面
  2. Laravel 身份验证页面
  3. 默认错误页面

If you are using custom themes or your own styles, you can use Laravel Elixer to compile them and which will create app.css for style files and app.js for javascript related files.

如果您使用自定义主题或您自己的样式,您可以使用 Laravel Elixer 来编译它们,这将为样式文件创建 app.css,为 javascript 相关文件创建 app.js。

https://laravel.com/docs/5.3/elixir

https://laravel.com/docs/5.3/elixir

https://laravel.com/docs/5.3/frontend

https://laravel.com/docs/5.3/frontend