Open hackzilla opened 9 years ago
This issue maybe related to #688
Current version of assetic:
"name": "kriswallsmith/assetic",
"version": "v1.2.1",
"source": {
"type": "git",
"url": "https://github.com/kriswallsmith/assetic.git",
"reference": "b20efe38845d20458702f97f3ff625d80805897b"
},
Previous version:
"name": "kriswallsmith/assetic",
"version": "v1.1.2",
"source": {
"type": "git",
"url": "https://github.com/kriswallsmith/assetic.git",
"reference": "735cffd3982c6e8cdebe292d5db39d077f65890f"
},
Did you install the less filter to be accessible globally? If not try the following:
$ sudo npm install -g less
And set the given path in your assetic filter setting.
I tried these ways(all not working for me):
ln -s /usr/lib/node_modules/ ~/.node_libraries
vendor/kriswallsmith/assetic/src/Assetic/Filter/LessFilter.php
, and the code require('less')
throw exception with Cannot find module 'less' when i visit my php page everytime,, but I cant do it OK at system terminal with node shell.ps: system info:
I solved this problem with using LessphpFilter
instand of LessFilter
, and that refer to stackoverflow
refer code as below:
<?php
use Assetic\Asset\AssetCollection;
use Assetic\Asset\FileAsset;
use Assetic\Filter\LessphpFilter;
// if you got error `Class 'lessc' not found`, 2 ways to solve:
// 1. execute `composer require leafo/lessphp`
// 2. download lessphp, and inclued code `require "path/to/lessc.inc.php";` in this file;
$css = new AssetCollection(array(
new FileAsset(
'/path/to/src/styles.less',
array(new LessphpFilter())
),
));
echo $css->dump();
you should configure the path to node libraries for your filter.
When using the bundle, it can be configured once for all filters using node.
I have a strange error:
However when I run the command manually it works.
'/usr/local/bin/node' '/tmp/assetic_lessAu0LRg'
This all worked when I was using Symfony 2.3, but not when using Symfony 2.6, when running on Ubuntu.
config.yml
I have managed to find a fix to allow assetic to compile the less again, however I don't understand why it is nessessary: