我想在Symfony2中使用Compass和Assetic配置Foundation5,我在http://foundation.zurb.com/docs/sass.html安装了基础:
npm install -g bower grunt-cli
gem install foundation
在config.yml
中以这种方式配置:
# Assetic Configuration
assetic:
debug: %kernel.debug%
use_controller: false
filters:
compass:
require: ['zurb-foundation']
apply_to: ".(scss|sass)$"
然后我导入了基本SCSS文件@import "foundation";
,但是当我运行:php app/console assetic:dump
时出现以下错误:
[Assetic\Exception\FilterException]
An error occurred while running:
'/usr/bin/ruby' '/usr/bin/compass' 'compile' '/tmp' '--images-dir' '/srv/www/vhosts/proj/app/../src/pro/MainB
undle/Resources/public/images' '--config' '/tmp/assetic_compass0NW1Qc' '--sass-dir' '' '--css-dir' '' '/tmp/assetic_compassT
0AFvM.scss'
Error Output:
Output:
create web/sprites/flags-s566f9ef717.png
create web/sprites/flags-s566f9ef717.png
error assetic_compassT0AFvM.scss (Line 7: File to import not found or unreadable: foundation.
Load paths:
/tmp
/usr/share/compass/frameworks/blueprint/stylesheets
/usr/share/compass/frameworks/compass/stylesheets
/srv/www/vhosts/proj/src/pro/MainBundle/Resources/public/css
/srv/www/vhosts/proj/src/pro/CompanyBundle/Resources/public/css
/srv/www/vhosts/proj/web/bundles/pro/css
Compass::SpriteImporter)
create assetic_compassT0AFvM.css
Input:
@import "base";
@import "header";
@import "global";
@import "foundation";
我还看到了他们要改变的升级页面http://foundation.zurb.com/docs/upgrading.html:
require "zurb-foundation"
为:
add_import_path "bower_components/foundation/scss"
但是不起作用,您是否有任何关于如何配置以便正常工作的建议?
配置更改
如果我更改config.yml
而不是要求,我会使用插件:
# Assetic Configuration
assetic:
debug: %kernel.debug%
use_controller: false
filters:
compass:
plugins: ['zurb-foundation']
apply_to: ".(scss|sass)$"
我收到此错误:
[Assetic\Exception\FilterException]
An error occurred while running:
'/usr/bin/ruby' '/usr/bin/compass' 'compile' '/tmp' '--images-dir' '/srv/www/vhosts/proj/app/../src/pro/MainB
undle/Resources/public/images' '--config' '/tmp/assetic_compass0qewOn' '--sass-dir' '' '--css-dir' '' '/tmp/assetic_compassQ
uKtrw.scss'
Error Output:
LoadError on line ["36"] of /usr/lib/ruby/1.9.1/rubygems/custom_require.rb: cannot load such file -- zurb-foundation
Run with --trace to see the full backtrace
Input:
@import "base";
@import "header";
@import "global";
@import "foundation";
答案 0 :(得分:3)
最后,我在config.yml
:
# Assetic Configuration assetic:
debug: %kernel.debug%
use_controller: false
filters:
compass:
load_paths:
- '%kernel.root_dir%/../app/Resources/public/vendor/bower_components/foundation/scss'
apply_to: ".(scss|sass)$"