在Symfony2中使用Compass和Assetic实现Foundation5 [英] Foundation5 with Compass and Assetic in Symfony2

查看:125
本文介绍了在Symfony2中使用Compass和Assetic实现Foundation5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Symfony2中用Compass和Assetic配置Foundation5,我已经按照 http://foundation.zurb.com/docs/sass.html

I want to config Foundation5 with Compass and Assetic in Symfony2, I have installed foundation as they say at 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 ; ,但是当我运行时: php app / console asset:dump 我遇到以下错误:

Then I have imported in a base SCSS file @import "foundation"; but when I run : php app/console assetic:dump I have the following error :

[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 他们说要更改的地方:

I saw also the upgrading page http://foundation.zurb.com/docs/upgrading.html where they say to change :

require "zurb-foundation"

至:

add_import_path "bower_components/foundation/scss"

但是不起作用,您对如何配置它以使其正常工作有任何建议吗?

However is not working, do you have any suggestions of how to configure this in order to work properly?

更改配置

如果我更改了 config.yml 而不是 require 我使用 plugins

If I change in config.yml instead of require I use plugins :

# 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";


推荐答案

最后,我喜欢<$ c $中的正确配置c> 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)$"

这篇关于在Symfony2中使用Compass和Assetic实现Foundation5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆