symfony - 使用MopaBootstrapBundle转储assetic时,出现运行时异常: The filename,目录名,或卷标语法不正确

标签 symfony twitter-bootstrap less

以下是完整的输出:

> php.exe C:\xampp\htdocs\bootstrap\app\console assetic:dump
Dumping all dev assets.
Debug mode is on.

[file+] C:\xampp\htdocs\bootstrap\app/../web/css/992f634.css
'stty' is not recognized as an internal or external command,
operable program or batch file.



  [RuntimeException]                                                  
  The filename, directory name, or volume label syntax is incorrect.  




assetic:dump [--watch] [--force] [--period="..."] [write_to]



Process finished with exit code 1 at 23:12:02.
Execution time: 1,118 ms.

正在安装 MopaBootstrapBundle。我无需样式即可访问该网站。可能出了什么问题?下面是我的 config.yml

# Assetic Configuration
assetic:
    debug:          %kernel.debug%
    use_controller: false
    # java: /usr/bin/java
    filters:
        cssrewrite: ~
        less:
            node: C:\nodejs
            node_paths: [C:\nodejs\node_modules]
        cssembed:
            jar: %kernel.root_dir%/Resources/java/cssembed-0.4.5.jar
        yui_css:
            jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
        yui_js:
            jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
        # closure:
        #     jar: %kernel.root_dir%/java/compiler.jar

请帮帮我,我不知道还能做什么。 =(

最佳答案

我无法获取less与我的 Symfony2 安装一起使用,所以我使用 lessphp 。以下是如何使用 MopaBootstrapBundle 配置 lessphp并有效地解决我的问题。顺便说一句,这个解决方案也类似于如何运行 MopaBootstrapBundle使用 Windows 机器。

//add this to your deps file, then install
[lessphp]
    git = "https://github.com/leafo/lessphp.git"
    target = "/lessphp"

//add this to your autoload.php
$loader->registerPrefixes(array(
    //some codes here
    'lessc'            => __DIR__.'/../vendor/lessphp',
));

//add this to config.yml
assetic:
    filters:
        less: ~
        lessphp:
            apply_to: "\.less$"
            file:   %kernel.root_dir%/../vendor/lessphp/lessc.inc.php

//override the layout.html.twig, either only to your bundle or from the app/Resources
{% extends 'MopaBootstrapBundle::layout.html.twig' %}
{% block head_style %}
    {% stylesheets
        '@MopaBootstrapBundle/Resources/public/less/mopabootstrapbundle.less'
    %}
    <link href="{{ asset_url }}" type="text/css" rel="stylesheet" media="screen" />
    {% endstylesheets %}
{% endblock head_style %}

希望这有帮助。 =)

关于symfony - 使用MopaBootstrapBundle转储assetic时,出现运行时异常: The filename,目录名,或卷标语法不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10451697/

相关文章:

symfony - 如何保护 Symfony 应用程序免受蛮力和恶意流量的侵害

forms - 所有页面上的 Symfony2/搜索面板

css - Bootstrap 网格不显示

javascript - Bootstrap 动画选项卡内容脚本

LESS mixin 调用另一个 mixin

css - 对评估的字符串颜色应用颜色函数

symfony - symfony2选民或ACL

javascript - Jquery onclick 事件触发一次

twitter-bootstrap - 导入 bootstrap less 以扩展类会在 glyphicons 字体上创建 404

php - Symfony 2 - 在 preSubmit 事件订阅者上向表单元素添加错误