2013-07-09 6 views
10

私は次のような状況に陥っています。 CLIからコンパスを使用しているときには、ちょうど動作し、正確に何が必要なのですか?私はconfig.rbファイルがある同じフォルダ(stylesフォルダ)からcompass compileを実行しています。また、sasscssディレクトリも含まれています。grunt-contrib-compassの仕事はできません

project_path = '.' 
css_dir = "css" 
sass_dir = "sass" 
images_dir = "../../data/images" 
javascripts_dir = "../scripts" 

output_style = :compressed 
environment = :development 
relative_assets = true 

私はこのためにgruntを使用しようとしているとき、私はGruntfile.jsに以下の構成を使用します: はここに私のconfig.rbファイルです

compass: { 
    compile: { 
     options: { 
      basePath: 'app/src/styles', 
      config: 'app/src/styles/config.rb' 
     } 
    } 
} 

appフォルダとGruntfile.jsは同じレベルに位置しています。 私は次の出力を参照してくださいgrunt compass実行している:

Running "compass:dist" (compass) task 
Nothing to compile. If you're trying to start a new project, you have left off the directory argument. 
Run "compass -h" to get help. 

Done, without errors. 

私は直接のようなすべてのオプションを指定しようとした場合:

compass: { 
    compile: { 
     options: { 
      basePath: 'app/src/styles', 
      sassDir: 'app/src/styles/sass', 
      cssDir: 'app/src/styles/css', 
      imagesDir: 'app/data/images' 
     } 
    } 
} 

それは仕事をしていませんが、.sass-cacheフォルダがで作成されますGruntfile.jsのレベル。 設定のbasePathオプションに問題があると思います。

何か間違っていますか?


EDIT:意図したとおり、私は、それを動作させるために管理
唯一の方法は、Gruntfile.jsのレベルにconfig.rbファイルを移動し、その中に次のオプションを指定している:

project_path = 'app/src/styles' 
css_dir = "css" 
sass_dir = "sass" 
images_dir = "../../data/images" 
javascripts_dir = "../scripts" 

output_style = :compressed 
environment = :development 
relative_assets = true 

また、このタスクに関する「Gruntfile.js」からすべてのオプションを削除しました。まだわからない、ここで何が起こっているのか。

compass: { 
    compile: { 
    options: { 
     basePath: 'app/src/styles', 
     config: 'app/src/styles/config.rb' 
    } 
    } 
} 

電源を入れへ:

compass: { 
     compile: { 
     options: { 
      config: 'app/src/styles/config.rb' 
     } 
     } 
    } 

も何を参照する--verboseスイッチ(grunt compass --verbose)を使用してGrunt Compassを実行

+0

HTTP上のコンパス0.12.latestを実行します。//blog.grayghostvisuals .com/css/image-url / –

答えて

3

はすなわち、兵卒の設定でbasePathを設定しませ試してみてくださいファイルのつぶやきが処理しようとしています。

グランツファイルのオプションに設定を追加すると、config.rbファイルの設定が上書き(または拡張)されます。

grunt-contrib-compassの詳細については、https://github.com/gruntjs/grunt-contrib-compassをご覧ください。それらはすべての可能なオプションに関する情報を持っています。

0

あなたのconfig.rbよりもあなたのプロジェクトのためのさまざまなベース・パスが必要な場合は、あなたが(でも相対)config.rbでのパス

例の設定を設定することができます。RB

project_path = "../src/main/webapp/" 
http_path  = "./" 
css_dir   = "css" 
sass_dir  = "../library" 
images_dir  = "assets/images" 
fonts_dir  = "assets/fonts" 
javascripts_dir = "assets/js" 

... 

relative_assets = true 

例SCSS

.stylesheet-url { 
    content:stylesheet-url("style.css"); 
} 

.font-url { 
    content:font-url("font.woff"); 
} 

.image-url { 
    content:image-url("image.png"); 
} 

.generated-image-url { 
    content:generated-image-url("image2.png"); 
} 

例CSS

.stylesheet-url { 
    content: url('style.css'); 
} 

.font-url { 
    content: url('../assets/fonts/font.woff'); 
} 

.image-url { 
    content: url('../assets/images/image.png'); 
} 

.generated-image-url { 
    content: url('../assets/images/image2.png'); 
} 

私たちは、Win7のx64の

関連する問題