在symfony2中使用assetic:dump时出错

时间:2013-11-06 09:10:14

标签: php symfony assetic

当我尝试输入此命令php app/console assetic:dump

时出现错误
[Assetic\Exception\FilterException]                                          
An error occurred while running:                                             
'/usr/local/bin/node' '/tmp/assetic_lesswt3ok6'                              

Error Output:                                                                
FileError: '../../bootstrap/less/bootstrap.less' wasn't found.               
 in mopabootstrapbundle.less:22:0                                            
21 // Main bootstrap.less entry point                                        
22 @import "../../bootstrap/less/bootstrap.less";                            
23                                                                           



Input:                                                                       
/*!                                                                          
 * MopaBootstrapBundle                                                       
 *                                                                           
 * Copyright 2011 Mohrenweiser & Partner                                     
 * Licensed under the Apache License v2.0                                    
 * http://www.apache.org/licenses/LICENSE-2.0                                
 *                                                                           
 * Import this file in your less files as first to be abled to access less   
vars from your file                                                          
 * OR                                                                        
 * Add it to the stylesheets of assetic or                                   
 * Add it as described on http://www.lesscss.org with the less.js (maybe pa  
thes must be adapted in that case)                                           
 *                                                                           
 * Be careful when using less this way, might be most straight forward, but  
 assetic doesnt check the included files                                     
 * for changes, and will only regenerate the css if it detects changes in t  
his file!                                                                    
 *                                                                           
 * For development it might be easier to include all you less files in the   
layout directly                                                              
 * But then assetic will compile each less file in a own compiler session s  
o you cant mix in the less style into bootstrap, which might not be OK       
 */                                                                          


// Main bootstrap.less entry point                                           
@import "../../bootstrap/less/bootstrap.less";                               

// variables                                                                 
@iconSpritePath:       "/bundles/mopabootstrap/bootstrap/img/glyphicons-hal  
flings.png";                                                                 
@iconWhiteSpritePath:  "/bundles/mopabootstrap/bootstrap/img/glyphicons-hal  
flings-white.png";                                                           

// The Paginator less for MopaBootstrapBundle                                
@import "paginator.less";                                                    

// The Subnav less for MopaBootstrapBundle                                   
@import "subnav.less";                                                       

// Collection support for MopaBootstrapBundle                                
@import "collections.less";                                                  

// Collection support for MopaBootstrapBundle                                
@import "google-maps.less";                                                  

// if you have any variables.less file INCLUDE IT AFTER EVERYTHING cause re  
sponsive.less also overrides it with the one from bootstrap!!!!!

我不明白错误来自何处。我试图搜索此错误,但没有一个解决方案正常工作

这是我的枝条文件

{% block stylesheets %}
    {{ parent() }}
    {% stylesheets 
        filter='cssrewrite,?yui_css'
        'bundles/mopabootstrap/css/mopabootstrapbundle.css'
    %}
        <link href="{{ asset_url }}" rel="stylesheet" type="text/css" />
    {% endstylesheets %}
{% endblock %}

2 个答案:

答案 0 :(得分:4)

我和mopabootstrap捆绑包有同样的错误。 用于安装符号链接的命令php app/console mopa:bootstrap:symlink:less正在vendor / mopa / bootstrap-bundle / Mopa / Bundle / BootstrapBundle / Resources中正确创建符号链接,但仍未找到bootstrap.less文件。

所以我通过复制vendor / mopa / bootstrap-bundle / Mopa / Bundle / BootstrapBundle / Resources中的vendor / twbs / bootstrap文件夹来修复它。 这不是一个真正合适的解决方案,但至少我可以抛弃资产。

答案 1 :(得分:1)

@Kevin是正确的,这是Kevin给出的演示解决方案:

  

php app / console mopa:bootstrap:symlink:less

     

初始化作曲家......完成。

     

检查符号链接...不存在

     

创建符号链接:   的/ var / WWW / carsing /供应商/ MOPA /引导束/摸爬/捆绑/ BootstrapBundle /资源/公共/自举

     

目标:../../../../../../../twbs/bootstrap ...确定

正如你可以看到mopa bundle需要(链接)bootstrap。

现在php app/console assetic:dump完全没有错误。