brunch / less-brunch

Adds LESS support to Brunch
14 stars 18 forks source link

@import "bootstrap.less" crashes #2

Closed ghost closed 12 years ago

ghost commented 12 years ago

Hi! Can anyone import twitter bootstrap?

I've noticed the error while importing reset.less from bootstrap dependencies:

rafals-macbook:lesstest rav$ brunch watch --server
2 Apr 16:47:13 - info: application started on http://0.0.0.0:3333.

/Users/rav/Code/brunch/lesstest/node_modules/less-brunch/node_modules/less/lib/less/parser.js:385
                    throw new(LessError)(e, env);
                          ^
[object Object]
mlamby commented 12 years ago

I had the same problem. I'm a bit of a brunch.io newb so at the moment I've only got a fairly hacky solution.

If you copy all of the bootstrap less files into you vendor directory, brunch build attempts to compile every file, and generates the error you've seen in your issue. If you look at the way the bootstrap build system is supposed to work you should just compile the single file bootstrap.less and this will call '@imports' on all the other bootstrap less files like reset.less.

I don't know how to tell brunch not compile all the .less files in the vendor directory, so I ended up moving them out of the vendor directory totally (e.g. into project_dir/bootstrap). Then in my app/styles/main.less I have the following:

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

That single import will compile the entire bootstrap library.

damassi commented 12 years ago

Documentation-wise, it may also be good to clearly address build-steps in library use-cases such as this, as bootstrap (et al) is greatly growing in popularity.

lipp commented 11 years ago

@paulmillr :Is this still the recommended way to include bootstrap?

paulmillr commented 11 years ago

@lipp if you want to extend less etc, put it in app/styles, for example, and import from there. if you don't, just put it in vendor/styles.

payner35 commented 11 years ago

worked for me.. thanks.

payner35 commented 11 years ago

one final newbie snag that might catch you with this approach.. tooltip.js should be loaded before popup.js..

before: [ 'vendor/scripts/console-helper.js', 'vendor/scripts/jquery-1.8.3.js', 'vendor/scripts/underscore-1.4.3.js', 'vendor/scripts/backbone-0.9.10.js', 'vendor/scripts/bootstrap/bootstrap-tooltip.js' ]

Adding it to the config file like this will get Bootstrap working.