Im trying to get Less with assetic working while developing on a windows OS.
Im loading an existing project of which I can alter the config.yml and parameters.yml files as necessary.
steps so far:
- I have installed Node.js via the msi installer
- I have used npm and installed less gloabally
config.yml
assetic:
debug: %kernel.debug%
use_controller: false
bundles: [ FOSUserBundle ]
filters:
less:
node: "C:\\Program Files (x86)\\nodejs\\node.exe" #/usr/local/bin/node
node_paths: [C:\Users\matt\AppData\Roaming\npm\node_modules\less] #[ /usr/local/lib/node_modules ]
apply_to: "\.less$"
Ive tried moving the appdata/roaming/npm/node_modules/less
dir straight into the local node_modules
dir in program files (x86)/nodejs/node_modules
dir to no avail.
Ive also tried setting adding the roaming/npm/node_modules/less
dir to the environment path, no joy.
Ive tried installing less
directly into the project and pointing the node_path directly to it, no joy.
the error in the outputted css file is as below:
[exception] 500 | Internal Server Error | Assetic\Exception\FilterException [message] An error occurred while running: "C:\Program Files (x86)\nodejs\node.exe" "C:\Users\Matt\AppData\Local\Temp\assEC1E.tmp"
(which is rather unhelpful)
any help appreciated, we're all a bit stuck in the office.
This is an old question but, as I've found the same problem and I finally solved it, I wanted to post the answer.
The recommended way to use LESS on Windows is to use lessphp package. To add it you just add in your composer json the following line:
Then you must run
and update your
app/config/config.yml
with this configuration:Once you have do this, you will be able to preprocess the LESS files and generate the CSS files.
Then when you want to process the files with assetic you just have to include that filter in your views like, for example: