Commit 43106236 by xzyfer

Restore behaviour of cwd in include path

Traditionally Sass has added the cwd as the first include path. This
behaviour was remove in Sass 3.4, and recently in LibSass 3.5.0.beta.2.
People depend on this behaviour and as a result a lot of compilations
are now failing.

This PR restores the expected behaviour and adds a test to boot.

Fixes #1876
parent 4271c700
......@@ -171,6 +171,11 @@ function buildIncludePaths(options) {
);
}
// Preserve the behaviour people have come to expect.
// This behaviour was removed from Sass in 3.4 and
// LibSass in 3.5.
options.includePaths.unshift(process.cwd());
return options.includePaths.join(path.delimiter);
}
......
......@@ -142,6 +142,23 @@ describe('api', function() {
});
});
it('should add cwd to the front on include paths', function(done) {
var src = fixture('cwd-include-path/root/index.scss');
var expected = read(fixture('cwd-include-path/expected.css'), 'utf8').trim();
var cwd = process.cwd();
process.chdir(fixture('cwd-include-path'));
sass.render({
file: src,
includePaths: []
}, function(error, result) {
assert.equal(result.css.toString().trim(), expected.replace(/\r\n/g, '\n'));
process.chdir(cwd);
done();
});
});
it('should check SASS_PATH in the specified order', function(done) {
var src = read(fixture('sass-path/index.scss'), 'utf8');
var expectedRed = read(fixture('sass-path/expected-red.css'), 'utf8').trim();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment