Ignore .css files in assetic lessphpfilter

How can I make Assetic LessPhpFilter only files with a specific extension (without) and ignore others (.css). I use the code below to create a combined css file

$fm = new Assetic\FilterManager(); $fm->set('less', new Assetic\Filter\LessphpFilter()); $factory = new Assetic\Factory\AssetFactory(APP_ROOT.'stylesheets'); $factory->setFilterManager($fm); $asset = $factory->createAsset($stylesheets, array('less'), array('debug' => false)); 
+4
source share
3 answers

It seems to be easiest to split css and fewer files in a separate folder. Makes the folder cleaner and you only need to download the folder where there are only fewer files. The css files should be generated in an additional folder called css or something else.

I'm not sure what you really want to do, but I think you should merge these css files after generating from a smaller file.

After fewer files have been created, you must make a second athletic tag in which you include your new css from the smaller file and your existing one. These two are automatically merged into one file with included ones. Hope this helps or helps you find a solution to the problem.

0
source

Try using

 $stylesheets = array('path/to/*.less'); $asset = $factory->createAsset($stylesheets, array('less'), array('debug' => false)); 

It must load inactive files

+4
source

Didn't use LessPhp filter, but you could try something like

 $file_details = pathinfo($file); 

and then using

 if($file_details['extension'] == ".less"){ //continue } 
+1
source

Source: https://habr.com/ru/post/1493346/


All Articles