I’ve been trying to compile Bootstrap 3 in a Symfony 2 project on Windows for some time now. But I can’t make it work. My main task is to build my own LESS file. I called it "styles.less". There I want to be able to use bootstrap mixes, for example, "make-xs-column". So I need to import bootstrap.less for this.
Here is what I have done so far:
In my composer.json, I added a bootstrap package:
{
...
"require": {
...
"twitter/bootstrap": "v3.0.3"
},
....
}
Since I want to use Bootstrap 3, I cannot use a lessphp filter, so I use a less filter instead. To do this, I had to install nodejs, and then less (by running the " npm install less -g" command ). Finally, I changed my config.yml as follows:
assetic:
debug: "%kernel.debug%"
use_controller: false
bundles: [ JoePersonalWebSiteBundle ]
filters:
cssrewrite: ~
less:
node: "C:\\dev\\nodejs\\lessc.cmd"
node_paths:
- "C:\\dev\\nodejs\\node_modules"
apply_to: "\.less$"
, layout.html.twig, :
{% stylesheets filter='less' '@JoePersonalWebSiteBundle/Resources/less/styles.less' %}
<link rel="stylesheet" type="text/css" href="{{ asset_url }}">
{% endstylesheets %}
"styles.less" "bootstrap.less" :
@import '../../../../../../vendor/twitter/bootstrap/less/bootstrap.less';
. , "styles.less" , , :
[exception] 500 | Internal Server Error | Assetic\Exception\FilterException
[message] An error occurred while running:
"C:\dev\nodejs\lessc.cmd" "C:\Users\joe\AppData\Local\Temp\assDE7E.tmp"
Error Output:
[31mParseError: missing opening `{`[39m[31m in [39mC:\Users\joe\AppData\Local\Temp\assDE7E.tmp[90m on line 17, column 1:[39m
[90m16 });[39m
17 [0m[0m
[1] Assetic\Exception\FilterException: An error occurred while running:
"C:\dev\nodejs\lessc.cmd" "C:\Users\joe\AppData\Local\Temp\assDE7E.tmp"
Error Output:
[31mParseError: missing opening `{`[39m[31m in [39mC:\Users\joe\AppData\Local\Temp\assDE7E.tmp[90m on line 17, column 1:[39m
[90m16 });[39m
17 [0m[0m
, , ( boteeka ). . . , .
- ? Windows Bootstrap 3 Symfony 2? , - , ?