I am trying to create a gulp-ruby-sass task however i am seeing the following error:
[17:32:34] gulp-ruby-sass: error ./styles.scss (Line 1: File to import not found
or unreadable: header.scss.
Load path: C:/Users/nassi/AppData/Local/Temp/gulp-ruby-sass)
My project structure:
app
assets
css
_header.scss
_home.scss
_navigation.scss
_buttons.scss
_dialogs.scss
styles.scss
Within styles.scss i have:
@import "header.scss";
@import "home.scss";
@import "navigation.scss";
@import "buttons.scss";
@import "dialogs.scss";
My gulp tasks:
var paths = {
sass: ['assets/css/styles.scss']
};
// SASS task
gulp.task('sass', function () {
gulp.src(paths.sass)
.pipe(sass())
.pipe(concat('all.min.css'))
.pipe(gulp.dest('assets/css/'));
});
My newly created all.min.css shows:
/*
Syntax error: File to import not found or unreadable: header.scss.
Load path: C:/Users/nassi/AppData/Local/Temp/gulp-ruby-sass
on line 1 of ./styles.scss
1: @import "header.scss";
2: @import "home.scss";
3: @import "navigation.scss";
4: @import "buttons.scss";
5: @import "dialogs.scss";
Backtrace:
./styles.scss:1
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/tree/import_node.rb:66:in `rescue in import'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/tree/import_node.rb:45:in `import'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/tree/import_node.rb:28:in `imported_file'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/tree/import_node.rb:37:in `css_import?'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/tree/visitors/perform.rb:283:in `visit_import'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/tree/visitors/base.rb:36:in `visit'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/tree/visitors/perform.rb:152:in `block in visit'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/stack.rb:79:in `block in with_base'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/stack.rb:121:in `with_frame'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/stack.rb:79:in `with_base'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/tree/visitors/perform.rb:152:in `visit'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/tree/visitors/base.rb:52:in `block in visit_children'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/tree/visitors/base.rb:52:in `map'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/tree/visitors/base.rb:52:in `visit_children'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/tree/visitors/perform.rb:161:in `block in visit_children'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/tree/visitors/perform.rb:173:in `with_environment'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/tree/visitors/perform.rb:160:in `visit_children'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/tree/visitors/base.rb:36:in `block in visit'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/tree/visitors/perform.rb:180:in `visit_root'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/tree/visitors/base.rb:36:in `visit'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/tree/visitors/perform.rb:151:in `visit'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/tree/visitors/perform.rb:8:in `visit'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/tree/root_node.rb:36:in `css_tree'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/tree/root_node.rb:20:in `render'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/engine.rb:274:in `render'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/plugin/compiler.rb:378:in `update_stylesheet'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/plugin/compiler.rb:189:in `block in update_stylesheets'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/plugin/compiler.rb:186:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/plugin/compiler.rb:186:in `update_stylesheets'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/plugin.rb:82:in `update_stylesheets'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/exec.rb:489:in `watch_or_update'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/exec.rb:346:in `process_result'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/exec.rb:43:in `parse'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/lib/sass/exec.rb:22:in `parse!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sass-3.3.10/bin/sass:13:in `<top (required)>'
C:/Ruby193/bin/sass:23:in `load'
C:/Ruby193/bin/sass:23:in `<main>'
*/
body:before {
white-space: pre;
font-family: monospace;
Im running Windows 7 64bit on Bootcamp
You must use the loadPath option like this:
// SASS task
gulp.task('sass', function () {
gulp.src(paths.sass)
.pipe(sass({
loadPath : __dirname + paths.sass
}))
.pipe(concat('all.min.css'))
.pipe(gulp.dest('assets/css/'));
});
It's necessary in newer versions of gulp-ruby-sass.
The SASS-partials you can import without any suffix:
@import "header";
@import "home";
@import "navigation";
@import "buttons";
@import "dialogs";
Ciao Ralf
来源:https://stackoverflow.com/questions/24870327/gulp-ruby-sass-unable-to-import-files