Laravel + Elixir:导入bootstrap更少的错误 [英] Laravel + Elixir: importing bootstrap less error
问题描述
我已将bower引导程序安装到 / vendor / bower_components
文件夹中。此外,我有一个app.less文件与此导入:
$ b
@import'/ vendor / bower_components / bootstrap / less / bootstrap';
目前运行时,当我运行 gulp
时,我得到了public.css编译一切都很顺利。但是,我已经重新安装npm / nvm / gulp / bower等类似的东西,然后在运行 gulp
时出错:
[15:19:07] gulp-notify:[Laravel Elixir]少编译失败!:'/vendor/bower_components/bootstrap/less/bootstrap.less'找不到。试过 - /vendor/bower_components/bootstrap/less/bootstrap.less文件/var/www/rld/resources/assets/less/app.less行号。 1
实际上,如果从导入路径中删除 /
(反斜杠) ,但我不太明白应该在我的主应用程序中使用什么路径。它的工作之前,但现在是打破了,但在我的另一台电脑上它工作正常(不知道我是否重新安装吞噬会发生什么)。所以我很困惑我应该用什么路径来导入更少的文件。
路径
选项。 当我们输入路径没有前导 /
( @import'/ vendor /
)编译器会从 app.less
( less / vendor
)。使用前导 /
,它会尝试在系统的 / vendor /
文件夹中找到该文件(绝对路径) 。
I've installed bootstrap with bower into /vendor/bower_components
folder. Also I have an app.less file with this import:
@import '/vendor/bower_components/bootstrap/less/bootstrap';
For the time being it worked, when I run gulp
I got public.css compiled and everything went good. However, I've reinstall npm/nvm/gulp/bower and such stuff and after then I got an error when running gulp
:
[15:19:07] gulp-notify: [Laravel Elixir] Less Compilation Failed!: '/vendor/bower_components/bootstrap/less/bootstrap.less' wasn't found. Tried - /vendor/bower_components/bootstrap/less/bootstrap.less in file /var/www/rld/resources/assets/less/app.less line no. 1
Actually it works if I remove /
(backslash) from the import path, but I don't quite understand what path should be used in my main app.less. It worked before but right now is broken, however on my another computer it works fine (not sure if I reinstall gulp what will happen). So I'm confused what path I should use for importing bootstrap less files.
See also https://github.com/plus3network/gulp-less#options and then especially the paths
option.
When you us the import path without the leading /
(@import '/vendor/
) the compiler will search relative from app.less
(less/vendor
). With a leading /
it will try to find the file in the /vendor/
folder on your system (absolute path).
这篇关于Laravel + Elixir:导入bootstrap更少的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!