Merge pull request #141 from themouette/features/fix-multiple-src
Fix multiple src with includePaths
This commit is contained in:
commit
2d2bf53474
2
index.js
2
index.js
|
@ -9,9 +9,9 @@ var fs = require('fs')
|
||||||
;
|
;
|
||||||
|
|
||||||
module.exports = function (options) {
|
module.exports = function (options) {
|
||||||
var opts = options ? clone(options) : {};
|
|
||||||
|
|
||||||
function sass (file, cb) {
|
function sass (file, cb) {
|
||||||
|
var opts = options ? clone(options) : {};
|
||||||
var fileDir = path.dirname(file.path);
|
var fileDir = path.dirname(file.path);
|
||||||
|
|
||||||
if (file.isNull()) {
|
if (file.isNull()) {
|
||||||
|
|
1
test/scss/include-path-tests/file1.scss
Normal file
1
test/scss/include-path-tests/file1.scss
Normal file
|
@ -0,0 +1 @@
|
||||||
|
@import "cats";
|
2
test/scss/include-path-tests/file2.scss
Normal file
2
test/scss/include-path-tests/file2.scss
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
@import "cats";
|
||||||
|
|
28
test/test.js
28
test/test.js
|
@ -5,8 +5,8 @@ var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var test = require('tape');
|
var test = require('tape');
|
||||||
|
|
||||||
function createVinyl(sassFileName, contents) {
|
function createVinyl(sassFileName, contents, base) {
|
||||||
var base = path.join(__dirname, 'scss');
|
base = base || path.join(__dirname, 'scss');
|
||||||
var filePath = path.join(base, sassFileName);
|
var filePath = path.join(base, sassFileName);
|
||||||
|
|
||||||
return new gutil.File({
|
return new gutil.File({
|
||||||
|
@ -101,6 +101,30 @@ test('compile multiple sass files', function (t) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('compile multiple sass files with includePaths', function (t) {
|
||||||
|
var files = [
|
||||||
|
createVinyl('file1.scss', null, path.join(__dirname, 'scss', 'include-path-tests')),
|
||||||
|
createVinyl('file2.scss', null, path.join(__dirname, 'scss', 'include-path-tests'))
|
||||||
|
];
|
||||||
|
var options = {
|
||||||
|
includePaths: [path.resolve(__dirname, 'scss', 'includes')]
|
||||||
|
};
|
||||||
|
|
||||||
|
t.plan(files.length * 4);
|
||||||
|
var stream = gsass(options);
|
||||||
|
|
||||||
|
stream.on('data', function (cssFile) {
|
||||||
|
t.ok(cssFile, 'cssFile exists');
|
||||||
|
t.ok(cssFile.path, 'cssFile.path exists');
|
||||||
|
t.ok(cssFile.relative, 'cssFile.relative exists');
|
||||||
|
t.ok(cssFile.contents, 'cssFile.contents exists');
|
||||||
|
});
|
||||||
|
|
||||||
|
files.forEach(function (file) {
|
||||||
|
stream.write(file);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test('emit error on sass errors', function (t) {
|
test('emit error on sass errors', function (t) {
|
||||||
var stream = gsass();
|
var stream = gsass();
|
||||||
var errorFile = createVinyl('somefile.sass',
|
var errorFile = createVinyl('somefile.sass',
|
||||||
|
|
Loading…
Reference in a new issue