cssrubygulpgulp-sassgulp-ruby-sass

Error in using gulp + foundation (sass version)


I want to use gulp + Foundation 6 + browserify. when run gulp in cli i have this error in terminal

write ./scss.css/foundation.css
path.js:7
throw new TypeError('Path must be a string. Received ' + inspect(path));
^

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.join (path.js:1211:7)
    at exports.replaceLocation (/Applications/MAMP/htdocs/Jober/node_modules/gulp-ruby-sass/lib/utils.js:32:14)
    at /Applications/MAMP/htdocs/Jober/node_modules/gulp-ruby-sass/index.js:179:13
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:416:3)

my gulpfile.js is:

var gulp        = require ('gulp'),
    logger      = require ('gulp-util'),
    concat      = require ('gulp-concat'),
    minifyCSS   = require ('gulp-minify-css'),
    compileSass = require ('gulp-ruby-sass');

var scss_sources,
    input_address,
    output_address;

// Input and Output Address
    input_address  = 'asstes/src/';
    output_address = 'asstes/dist/';

// Style Sources
    scss_sources = [
        'node_modules/foundation-sites/scss',
        input_address + 'style/style.scss'];

    gulp.task('styles', function(){
        return compileSass(scss_sources, { style: 'expanded' })
               .pipe(autoprefixer({
                   browsers: ['last 2 versions', 'ie >= 9', 'and_chr >= 2.3'],
                   cascade: false
               }))
               .pipe(minifyCSS())
               .on('error', logger.log)
               .pipe(gulp.dest(output_address + 'style'));
    });

gulp.task('watch', function(){
    gulp.watch(input_address + 'style/pages/*.scss', ['styles']),
});

gulp.task('default', ['styles' , 'watch']);

my style.scss is:

//Modules
@import 'foundation';

//Pages
@import 'pages/index';

and my folders structure is:

PROJECT FOLDER
    |
    |_assets
    |    |_dist
    |    |   |_img
    |    |   |_js
    |    |   |_style
    |    |
    |    |_src
    |        |_img
    |        |_js
    |        |_style
    |
    |_node_modules
    |        |_foundation-site
    |
    |_gulpfile.js

I'd used gulp-compass before gulp-ruby-sass but, had popular error: Individual stylesheets must be in the sass directory, therefore change plugin to gulp-ruby-sass.

How can I fix it?


Solution

  • It might be that the string concatenation is not working correctly in the scss_sources.

    Try changing scss_sources to:

    scss_sources = [
         'node_modules/foundation-sites/scss',
         'asstes/src/style/style.scss'
    ];
    

    And see does that work, if so it's the concatenation.