При сбросе активов с использованием MopaBootstrapBundle возникает исключение времени выполнения: неверный синтаксис имени файла, имени каталога или метки тома.

Ниже приведен полный вывод:

> 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

Пожалуйста, помогите мне, я не знаю, что еще делать. знак равно


person bernardnapoleon    schedule 04.05.2012    source источник


Ответы (1)


Мне не удалось заставить less работать с моей установкой Symfony2, поэтому вместо этого я использовал lessphp. вот как настроить lessphp с помощью MopaBootstrapBundle и эффективно устранить мою проблему. Кстати, это решение также похоже на то, как запустить 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 %}

Надеюсь это поможет. знак равно

person bernardnapoleon    schedule 05.05.2012
comment
Спасибо! В моей рабочей среде не было узла, так что это отличная альтернатива. На 2.1 это тоже немного проще, вам просто нужно добавить его в composer.json и изменить путь строки конфигурации с vendor/lessphp на vendor/leafo/lessphp - person Adrian Schneider; 07.06.2012