1
我在嘗試使用symfony2和asseticbundle的scss文件。Symfony2中的Sass/Compass
我config.yml assetic部分:
assetic:
debug: %kernel.debug%
use_controller: false
bundles: []
filters:
sass: ~
compass: ~
#closure:
# jar: "%kernel.root_dir%/Resources/java/compiler.jar"
#yui_css:
# jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
我base.html.twig:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>{% block title %}Welcome!{% endblock %}</title>
{% block stylesheets %}
{% stylesheets filters="compass"
"@TestBundle/Resources/public/sass/main.scss"
%}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
{% endblock %}
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
</head>
<body ng-app="myapp">
{% block body %}{% endblock %}
{% block javascripts %}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script src="{{ asset('js/app.js') }}" />
{% endblock %}
我main.scss在TestBundle /資源/大衆/上海社會科學院/ main.scss
$background: #000;
body{
background-color:$background;
}
這是即時得到錯誤:這個問題是過濾器字這不得不過濾
Unexpected token "name" of value "filters" in app/Resources/views/base.html.twig at line 7
見,如果這個工程:http://www.craftitonline.com/2011/06/symfony2-beautify-with-assetic-and-a-template-部分-II /。我認爲這與刪除樣式表位置中的@有關。 – bassplayer7 2015-04-01 18:05:24