I am using the external_pipeline with MM via Gulp.
activate :external_pipeline,
name: :gulp_pipeline,
command: build? ?
'node_modules/gulp/bin/gulp.js build' :
'node_modules/gulp/bin/gulp.js dev',
source: ".tmp/dist",
latency: 1
Gulp sass task is pretty straight forward…
gulp.task('sass', function() {
gulp.src(config.sassPath + '/all.scss')
.pipe(sass({
includePaths: [config.nodePath],
errLogToConsole: true
}))
.pipe(gulp.dest(config.destFolder));
});
Because I want to @imports *.css
into my *.scss
file, I use libSass. libSass allows you to @import
*.css
files into *.scss
by leaving off the extension. Ruby Sass won’t allow this and throws an error (if you leave the *.css extension on, Ruby Sass will copy over the @import
statement, not concatenate the file into the *.scss
file). I am doing with bootstrap file below…
//pulling file from node_modules
@import "node_modules/bootstrap/dist/css/bootstrap";
//pulling file from local stylesheets folder
@import "./mixins";
Running middleman build
seems spin off the gulp build
process and correctly build the *.scss
file correctly (the build/all.scss
is ok).
But, there in build/stylesheets/all
there is an error file.
/*
Error: File to import not found or unreadable: node_modules/bootstrap/dist/css/bootstrap.
on line 1 of /Users/me/Code/TrailMaker/source/stylesheets/all.scss
1: @import "node_modules/bootstrap/dist/css/bootstrap";
2: @import "node_modules/medium-editor/dist/css/medium-editor";
3: @import "node_modules/medium-editor/dist/css/themes/Beagle";
4: @import "node_modules/react-toggle/style";
5:
6: @import "./mixins";
Backtrace:
/Users/me/Code/TrailMaker/source/stylesheets/all.scss:1
/Users/me/.rvm/gems/ruby-2.1.7/gems/sass-3.4.22/lib/sass/tree/import_node.rb:67:in `rescue in import'
/Users/me/.rvm/gems/ruby-2.1.7/gems/sass-3.4.22/lib/sass/tree/import_node.rb:45:in `import'
/Users/me/.rvm/gems/ruby-2.1.7/gems/sass-3.4.22/lib/sass/tree/import_node.rb:28:in `imported_file'
While libSass seems to build the file correctly, it also seems that Ruby Sass is also having a go at @import
statements and is failing?