Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imports and Partials #27

Closed
Thomas-P opened this issue Feb 22, 2014 · 5 comments
Closed

Imports and Partials #27

Thomas-P opened this issue Feb 22, 2014 · 5 comments

Comments

@Thomas-P
Copy link

The Example in the README.md doesn't work for me. I got an error message, because it doesn't found the settings.scss;

stream.js:94
      throw er; // Unhandled stream error in pipe.
            ^
[gulp] Error in plugin 'gulp-sass': source string:1: error: file to import not found or unreadable: "includes/_settings"

I used the gulpfile.js from the example:

var gulp = require('gulp');
var sass = require('gulp-sass');

gulp.task('sass', function () {
    gulp.src('./scss/*.scss')
        .pipe(sass())
        .pipe(gulp.dest('./css'));
});
gulp.task('default',['sass']);

The failure was thrown by the @import in style.scss. When i import it like

@import "scss/includes/_settings";

it would work. That means it will use the Working and not the localdir. I wrote a little Workaround for that, but it will be better to set a root-Path to the options wich will be added to opts.includePaths.

module.exports = function (options) {
  var opts = options ? options : {};

  function nodeSass (file, cb) {
    var fileDir = path.dirname(file.path);
    fileDir = path.relative(__dirname,fileDir);
    var tmp = [];
    fileDir.split(path.sep).forEach(function(element) {
      if ('..' != element)
        tmp.push(element);
    });
    fileDir = tmp.join(path.sep)+path.sep;

[...]

I hope it will help,

thanks..

@el-rotny
Copy link

@Thomas-P The proper Sass way is to just name the file without extensions or leading underscore. SASS is smart enough to know if its a partial or not.

@Thomas-P
Copy link
Author

@sugarskull

I have only implemented the example 1 to 1.
The import of "scss/includes/_settings.scss:" wouldn't be found.

Maybe a problem with Linux, I couldn't test it on Windows.

I hope the workaround could be added to the code.

@davidtheclark
Copy link
Contributor

@Thomas-P what is your directory structure? I'd suspect that maybe your import path is just wrong. E.g. if you have

  • main.scss
  • includes/
    • _settings.scss

Then then import should be @import "includes/settings"; without the scss up front.

@adam-beck
Copy link

I think that @Thomas-P just had an incorrect folder structure or incorrect import statement. This should likely be closed. I was not able to re-create it.

@dlmanning
Copy link
Owner

closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants