2017-08-20 27 views
0

gulp-compassプラグインを使用して、scssをCSSに変換して縮小しようとしています。 私はエラーの下に取得していますしかし:gulp compassがエラーをスローする

$ gulp compass [02:14:32] Using gulpfile C:\Users\dell\Desktop\sassy - copy\gulpfile.js [02:14:32] Starting 'compass'... [02:14:32] Finished 'compass' after 13 ms [02:14:33] LoadError on line ["55"] of C: cannot load such file -- bourbon Run with --trace to see the full backtrace

events.js:160 throw er; // Unhandled 'error' event ^Error: Compass failed

これは私のSCSSファイルがどのように見えるかです:

.scssファイル:

@import 'bower_components/bourbon/app/assets/stylesheets/bourbon'; 
@import 'bower_components/normalize-css/normalize'; 
@import 'bower_components/susy/sass/susy'; 

@import url('https://fonts.googleapis.com/css?family=Playfair+Display|Raleway'); 

@import 'partials/variables'; 
@import 'partials/base'; 
@import 'partials/footer'; 
@import 'partials/header'; 
@import 'partials/layout'; 
@import 'partials/modules'; 

後はgulpfile.jsです:

var gulp = require('gulp'), 
    compass = require('gulp-compass'), 
    minifyCSS = require('gulp-minify-css'); 

gulp.task('compass', function() { 
    gulp.src('assets/scss/styles.scss') 
    .pipe(compass({ 
     sass: 'assets/sass', 
     image: 'images', 
     require:['bourbon', 'normalize','susy'] 
     })) 
    .pipe(minifyCSS()) 
    .pipe(gulp.dest('css')); 
}); 

私はそのプラグインを許可しないと思いますbourbonnormalizesusyをコンパイルして変換します。私は間違った設定をしたかもしれないと思います。

は宝石をインストールしようとしましたが、次のエラーがスローされます。

gem install susy

gem install bourbon

c:\Users\Dell\Desktop\sassy - Copy>gulp compass 
[23:23:59] Using gulpfile c:\Users\Dell\Desktop\sassy - Copy\gulpfile.js 
[23:23:59] Starting 'compass'... 
[23:23:59] Finished 'compass' after 14 ms 
    error assets/sass/styles.scss (Line 1: File to import not found or unreadable: bower_components/bourbon/app/assets/stylesheets/bourbon. 
Load paths: 
    Compass::SpriteImporter 
    c:/Users/Dell/Desktop/sassy - Copy/assets/sass 
    C:/Ruby24/lib/ruby/gems/2.4.0/gems/compass-core-1.0.3/stylesheets 
    C:/Ruby24/lib/ruby/gems/2.4.0/gems/susy-2.2.12/sass 
    C:/Ruby24/lib/ruby/gems/2.4.0/gems/bourbon-4.3.4/app/assets/stylesheets) 

Compilation failed in 1 files. 


events.js:160 
     throw er; // Unhandled 'error' event 
    ^
Error:  error assets/sass/styles.scss (Line 1: File to import not found or unreadable: bower_components/bourbon/app/assets/stylesheets/bourbon. 
Load paths: 
    Compass::SpriteImporter 
    c:/Users/Dell/Desktop/sassy - Copy/assets/sass 
    C:/Ruby24/lib/ruby/gems/2.4.0/gems/compass-core-1.0.3/stylesheets 
    C:/Ruby24/lib/ruby/gems/2.4.0/gems/susy-2.2.12/sass 
    C:/Ruby24/lib/ruby/gems/2.4.0/gems/bourbon-4.3.4/app/assets/stylesheets) 
Compilation failed in 1 files. 

答えて

1

理由は非常に簡単です、必要なRubyの宝石、ないバウアーまたはノードライブラリです。 docから

Require the given Ruby library before running commands. This is used to access Compass plugins without having a project configuration file.

あなたはRubyの宝石をインストールしない場合、あなたがそれらを必要とすることができますが。

gem install susy 
gem install bourbon 

正規化-CSSをRubyの宝石を持っていないようです。


新しいエラー:

この質問はあなたWhy is Compass is giving me an import error when trying to import partials役立つかもしれない、あなたはそれ以外の場合は、必要なRubyの宝石のパスを検索します、相対パスを使用する必要があります(私はあなたがバウアーパッケージがインストールされていると思います)。

だから@import 'bower_components/bourbon/app/assets/stylesheets/bourbon';

@import './bower_component/..

にと同様、すべてのものに変更します。

+0

宝石のインストール後に試しましたが失敗しました。私はポストに痕跡をつけています。 –

+0

@AakashThakur私は自分の答えを更新しました。 – aristotll

+0

私はこの相対的なパスの事が邪魔だと思います。しかし、それはまだエラーを投げているので、正規化インポートと何をするか私を導くことができます。 –

関連する問題