Note that there are some explanatory texts on larger screens.

plurals
  1. POCompiling Bootstrap 3 in a Symfony 2 project on Windows
    text
    copied!<p>I have been trying for some time now to compile Bootstrap 3 in a Symfony 2 project on Windows. But I can't get it to work. My primary objective is to compile my very own LESS file. I called it "styles.less". In there, I want to be able to use bootstrap mixins like "make-xs-column" for example. So I need to import bootstrap.less for that.</p> <p>Here is what I did so far:</p> <p>In my composer.json, I added the bootstrap bundle:</p> <pre><code>{ ... "require": { ... "twitter/bootstrap": "v3.0.3" }, .... } </code></pre> <p>Since I want to use Bootstrap 3, I cannot use the lessphp filter, so I use the less filter instead. For that, I had to install nodejs, and then less (by running the command "<code>npm install less -g</code>"). Finally, I modified my config.yml like so:</p> <pre><code>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$" </code></pre> <p>Now, in my layout.html.twig, I added the following:</p> <pre><code>{% stylesheets filter='less' '@JoePersonalWebSiteBundle/Resources/less/styles.less' %} &lt;link rel="stylesheet" type="text/css" href="{{ asset_url }}"&gt; {% endstylesheets %} </code></pre> <p>And in my "styles.less" file, I import"bootstrap.less" like so:</p> <pre><code>@import '../../../../../../vendor/twitter/bootstrap/less/bootstrap.less'; </code></pre> <p>But I always get an error. In fact, even if my "styles.less" file is completely empty, I always get an error like this one:</p> <pre><code>[exception] 500 | Internal Server Error | Assetic\Exception\FilterException [message] An error occurred while running: &amp;quot;C:\dev\nodejs\lessc.cmd&amp;quot; &amp;quot;C:\Users\joe\AppData\Local\Temp\assDE7E.tmp&amp;quot; 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: &amp;quot;C:\dev\nodejs\lessc.cmd&amp;quot; &amp;quot;C:\Users\joe\AppData\Local\Temp\assDE7E.tmp&amp;quot; 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 </code></pre> <p>I tried to create my own recess filter to use that instead of less (based on the work by boteeka <a href="https://github.com/kriswallsmith/assetic/pull/482" rel="nofollow">found here</a>). But that didn't work either. The less files never compile. Even an empty one, or a simple one.</p> <p>Could someone please point me in the right direction? Is it possible on Windows, to compile Bootstrap 3 in a Symfony 2 project? If so, can someone give me the exact steps I should follow?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload