gpt4 book ai didi

php - Symfony 2 Assets 过滤器异常中的 compass

转载 作者:IT王子 更新时间:2023-10-29 00:57:17 25 4
gpt4 key购买 nike

我已经在我的 symfony 2 项目中安装了 compass。现在我想将 assetic 过滤器与 compass 结合使用。我正在使用 Windows 7。

我认为它几乎可以正常工作,但我仍然收到此错误:

[Assetic\Exception\FilterException]
An error occurred while running:
"C:\Ruby21-x64\bin\ruby.EXE" "C:\Ruby21-x64\bin\compass.BAT" "compile" "C:\
Users\tommie\AppData\Local\Temp" "--boring" "--config" "C:\Users\tommie\App
Data\Local\Temp\ass4325.tmp" "--sass-dir" "" "--css-dir" "" "C:/Users/tommi
e/AppData/Local/Temp/ass4326.tmp.scss"
Error Output:
C:/Ruby21-x64/bin/compass.BAT:1: syntax error, unexpected tCONSTANT, expect
ing end-of-input

我的 html 代码(twig):stylesheets.html.twig

{% stylesheets filter="compass" output='css/compiled/*.css'
"@AcmeSassDemoBundle/Resources/assets/css/base.scss"
%}
<link rel="stylesheet" href="{{ asset_url }}" />

{% endstylesheets %}

base.html.twig:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{% block title %}Sass Demo!{% endblock %}</title>
{#{% block stylesheets %}{% endblock %} #}

{% include "AcmeSassDemoBundle:Demo:stylesheets.html.twig" %}
<link rel="shortcut icon" href="{{ asset('favicon.ico') }}" />
</head>
<body>
<div id="header">
{% block header %}
<h1>Sass Demo</h1>
<div class="logo">this container is half as big as the sass.gif's dimension</div>
{% endblock %}
</div>

<div id="menu">
<ul>
<li class="add"><a href="#">add something</a></li>
<li class="edit"><a href="#">edit something</a></li>
<li class="delete"><a href="#">delete something</a></li>
</ul>
</div>

<div id="content">
{% block body %}hello sass!{% endblock %}
</div>

<div id="footer">
{% block footer %}awesome footer goes here ...{% endblock %}
</div>
{% block javascripts %}{% endblock %}</
</body>

index.html.twig:

{% extends 'AcmeSassDemoBundle:Demo:base.html.twig' %}

{% block body %}

<div class="content">
hello world
<div class="sub">
This text should be in green ...
<div class="sub">
... and this one in blue!
</div>
</div>

我的 config.yml 过滤器 Assets 配置:

# Assetic Configuration
assetic:
debug: false
use_controller: true# default: true
filters:
sass: ~
compass:
compass:
bin: C:\Ruby21-x64\bin\compass.bat

基础.scss

$main-background-color: #FFF;
$main-color: #FFF;
$light-color: #759E1A;
$link-color: #0088CC;

body {
background-color: #CCC;
}

@mixin rounded($side, $radius: 10px) {
border-radius: $radius;
border-#{$side}-radius: $radius;
-moz-border-radius-#{$side}: $radius;
-webkit-border-#{$side}-radius: $radius;
}

@import "header.scss";
@import "menu.scss";
@import "content.scss";
@import "footer.scss";

最佳答案

我不想让你气馁,但是使用 Windows 和 Ruby,这是最糟糕的组合,(节点也是,具有长树子目录的 node_module,使 Windows 限制为 256 个字符,并且通过安装包)。我的观点就像将您的项目移动到与您的服务器配置类似的虚拟机的替代方法。 (VirtualBox 和 Vagrant)

Linux 对 Ruby 更友好(它支持他)并且有符号链接(symbolic link)和长路径名;

修补: https://symfony.com/doc/2.8/setup/homestead.html

也许这个旧链接也会有所帮助: How to use SCSS filter in Symfony2 under Windows?

关于php - Symfony 2 Assets 过滤器异常中的 compass ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29515006/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com