0

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.

Victor
  • 5,073
  • 15
  • 68
  • 120

2 Answers2

2

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).

Bass Jobsen
  • 48,736
  • 16
  • 143
  • 224
  • I'm just confused why the behaviour has changed. It always worked with leading "/", like if I have /var/www/myproject and used @import "/vendor/bower_components..", gulp always search in the project root dir. Anyway, I'm not that experienced with gulp, I use laravel elixir, how can I change the path option? Thanks by the way :) – Victor Apr 21 '15 at 11:11
-1

You may change your app.less @import as follow:

@import "../../../vendor/bower_components/bootstrap/less/bootstrap";

Works for us

Rene Vorndran
  • 693
  • 1
  • 6
  • 13