maoberlehner / node-sass-magic-importer

Custom node-sass importer for selector specific imports, module importing, globbing support and importing files only once.
MIT License
292 stars 28 forks source link

Can't find stylesheet to import #262

Open jaywork2020 opened 1 year ago

jaywork2020 commented 1 year ago

Thank for for this library. I am trying to use the module with gulp-sass. I tried to do something like this

@import '{ .btn } from ../../node_modules/bootstrap/scss/bootstrap';

But that gives me this error

Can't find stylesheet to import

The gulpfile look something like this

const gulp = require('gulp'),
          sass = require('gulp-sass')(require('sass')),
          magicImporter = require('node-sass-magic-importer');

gulp.task('styles', () => {
  return gulp.src('./src/styles/main.scss')
      .pipe(sass({
          importer: magicImporter(),
          precision: 10,
      }).on('error', function(err) {
          sass.logError(err);
      }))
      .pipe(gulp.dest('./dist'));
});

I tried to debug the node-sass-magic-importer, it seems to be returning the correct data object

{
    file: 'C:......bootstrap.scss', // correct full path
    contents: '.....' // the content of the bootstrap.scss file
}

Thanks for your help

jaywork2020 commented 1 year ago

I updated the issue details as I did some troubleshooting trying to find the cause. Still not sure why.