Comparing version 1.0.1 to 2.0.0
@@ -24,6 +24,2 @@ var async = require('async'); | ||
if (options.currentPath) { | ||
filePaths.unshift(path.resolve(options.basePath, options.currentPath, to)); | ||
} | ||
return new Promise(function (resolve, reject) { | ||
@@ -30,0 +26,0 @@ async.detectSeries(filePaths, exists, function (resolvedPath) { |
{ | ||
"name": "assets", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"description": "An asset manager for node", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -113,7 +113,2 @@ <h1 align="center"> | ||
### `currentPath` | ||
The path to the currently processed file. | ||
There is no default `currentPath`. | ||
### `cachebuster` | ||
@@ -223,3 +218,2 @@ If cache should be busted. If set to `true`, Assets will bust assets cache, changing urls depending on asset’s modification date: | ||
* current path; | ||
* load paths; | ||
@@ -226,0 +220,0 @@ * base path. |
@@ -21,11 +21,2 @@ var path = require('path'); | ||
test('currentPath', function (t) { | ||
return resolvePath('knitwork.gif', { | ||
currentPath: 'fixtures/patterns' | ||
}) | ||
.then(function (resolvedPath) { | ||
t.is(resolvedPath, path.resolve('fixtures/patterns/knitwork.gif')); | ||
}, t.fail); | ||
}); | ||
test('loadPaths', function (t) { | ||
@@ -40,12 +31,2 @@ return resolvePath('picture.png', { | ||
test('basePath + currentPath', function (t) { | ||
return resolvePath('knitwork.gif', { | ||
basePath: 'fixtures', | ||
currentPath: 'patterns' | ||
}) | ||
.then(function (resolvedPath) { | ||
t.is(resolvedPath, path.resolve('fixtures/patterns/knitwork.gif')); | ||
}, t.fail); | ||
}); | ||
test('basePath + loadPaths', function (t) { | ||
@@ -61,23 +42,2 @@ return resolvePath('picture.png', { | ||
test('currentPath + loadPaths', function (t) { | ||
return resolvePath('knitwork.gif', { | ||
currentPath: 'fixtures/patterns', | ||
loadPaths: ['fixtures/fonts', 'fixtures/images'] | ||
}) | ||
.then(function (resolvedPath) { | ||
t.is(resolvedPath, path.resolve('fixtures/patterns/knitwork.gif')); | ||
}, t.fail); | ||
}); | ||
test('basePath + currentPath + loadPaths', function (t) { | ||
return resolvePath('knitwork.gif', { | ||
basePath: 'fixtures', | ||
currentPath: 'patterns', | ||
loadPaths: ['fonts', 'images'] | ||
}) | ||
.then(function (resolvedPath) { | ||
t.is(resolvedPath, path.resolve('fixtures/patterns/knitwork.gif')); | ||
}, t.fail); | ||
}); | ||
test('absolute needle + basePath', function (t) { | ||
@@ -93,12 +53,2 @@ var absoluteTo = path.resolve('fixtures/duplicate-1.jpg'); | ||
test('absolute basePath + currentPath', function (t) { | ||
return resolvePath('knitwork.gif', { | ||
basePath: path.resolve('fixtures'), | ||
currentPath: path.resolve('fixtures/patterns') | ||
}) | ||
.then(function (resolvedPath) { | ||
t.is(resolvedPath, path.resolve('fixtures/patterns/knitwork.gif')); | ||
}, t.fail); | ||
}); | ||
test('absolute basePath + loadPaths', function (t) { | ||
@@ -125,12 +75,2 @@ return resolvePath('picture.png', { | ||
test('prioritize currentPath over the basePath', function (t) { | ||
return resolvePath('duplicate-1.jpg', { | ||
basePath: 'fixtures', | ||
currentPath: 'images' | ||
}) | ||
.then(function (resolvedPath) { | ||
t.is(resolvedPath, path.resolve('fixtures/images/duplicate-1.jpg')); | ||
}, t.fail); | ||
}); | ||
test('prioritize basePath over the loadPaths', function (t) { | ||
@@ -137,0 +77,0 @@ return resolvePath('duplicate-1.jpg', { |
164
test/url.js
@@ -42,11 +42,2 @@ var fs = require('fs'); | ||
test('currentPath', function (t) { | ||
return resolveUrl('knitwork.gif', { | ||
currentPath: 'fixtures/patterns' | ||
}) | ||
.then(function (resolvedUrl) { | ||
t.is(resolvedUrl, '/fixtures/patterns/knitwork.gif'); | ||
}, t.fail); | ||
}); | ||
test('loadPaths', function (t) { | ||
@@ -80,12 +71,2 @@ return resolveUrl('picture.png', { | ||
test('basePath + currentPath', function (t) { | ||
return resolveUrl('knitwork.gif', { | ||
basePath: 'fixtures', | ||
currentPath: 'patterns' | ||
}) | ||
.then(function (resolvedUrl) { | ||
t.is(resolvedUrl, '/patterns/knitwork.gif'); | ||
}, t.fail); | ||
}); | ||
test('basePath + loadPaths', function (t) { | ||
@@ -111,12 +92,2 @@ return resolveUrl('picture.png', { | ||
test('baseUrl + currentPath', function (t) { | ||
return resolveUrl('knitwork.gif', { | ||
baseUrl: 'http://example.com/wp-content/themes', | ||
currentPath: 'fixtures/patterns' | ||
}) | ||
.then(function (resolvedUrl) { | ||
t.is(resolvedUrl, 'http://example.com/wp-content/themes/fixtures/patterns/knitwork.gif'); | ||
}, t.fail); | ||
}); | ||
test('baseUrl + loadPaths', function (t) { | ||
@@ -142,22 +113,2 @@ return resolveUrl('picture.png', { | ||
test('currentPath + loadPaths', function (t) { | ||
return resolveUrl('knitwork.gif', { | ||
currentPath: 'fixtures/patterns', | ||
loadPaths: ['fixtures/fonts', 'fixtures/images'] | ||
}) | ||
.then(function (resolvedUrl) { | ||
t.is(resolvedUrl, '/fixtures/patterns/knitwork.gif'); | ||
}, t.fail); | ||
}); | ||
test('currentPath + relativeTo', function (t) { | ||
return resolveUrl('knitwork.gif', { | ||
currentPath: 'fixtures/patterns', | ||
relativeTo: 'fixtures/fonts' | ||
}) | ||
.then(function (resolvedUrl) { | ||
t.is(resolvedUrl, '../patterns/knitwork.gif'); | ||
}, t.fail); | ||
}); | ||
test('loadPaths + relativeTo', function (t) { | ||
@@ -173,13 +124,2 @@ return resolveUrl('picture.png', { | ||
test('basePath + baseUrl + currentPath', function (t) { | ||
return resolveUrl('knitwork.gif', { | ||
basePath: 'fixtures', | ||
baseUrl: 'http://example.com/wp-content/themes', | ||
currentPath: 'patterns' | ||
}) | ||
.then(function (resolvedUrl) { | ||
t.is(resolvedUrl, 'http://example.com/wp-content/themes/patterns/knitwork.gif'); | ||
}, t.fail); | ||
}); | ||
test('basePath + baseUrl + loadPaths', function (t) { | ||
@@ -207,24 +147,2 @@ return resolveUrl('picture.png', { | ||
test('basePath + currentPath + loadPaths', function (t) { | ||
return resolveUrl('knitwork.gif', { | ||
basePath: 'fixtures', | ||
currentPath: 'patterns', | ||
loadPaths: ['fonts', 'images'] | ||
}) | ||
.then(function (resolvedUrl) { | ||
t.is(resolvedUrl, '/patterns/knitwork.gif'); | ||
}, t.fail); | ||
}); | ||
test('basePath + currentPath + relativeTo', function (t) { | ||
return resolveUrl('knitwork.gif', { | ||
basePath: 'fixtures', | ||
currentPath: 'patterns', | ||
relativeTo: 'fonts' | ||
}) | ||
.then(function (resolvedUrl) { | ||
t.is(resolvedUrl, '../patterns/knitwork.gif'); | ||
}, t.fail); | ||
}); | ||
test('basePath + loadPaths + relativeTo', function (t) { | ||
@@ -241,24 +159,2 @@ return resolveUrl('picture.png', { | ||
test('baseUrl + currentPath + loadPaths', function (t) { | ||
return resolveUrl('knitwork.gif', { | ||
baseUrl: 'http://example.com/wp-content/themes', | ||
currentPath: 'fixtures/patterns', | ||
loadPaths: ['fixtures/fonts', 'fixtures/images'] | ||
}) | ||
.then(function (resolvedUrl) { | ||
t.is(resolvedUrl, 'http://example.com/wp-content/themes/fixtures/patterns/knitwork.gif'); | ||
}, t.fail); | ||
}); | ||
test('baseUrl + currentPath + relativeTo', function (t) { | ||
return resolveUrl('knitwork.gif', { | ||
baseUrl: 'http://example.com/wp-content/themes', | ||
currentPath: 'fixtures/patterns', | ||
relativeTo: 'fixtures/fonts' | ||
}) | ||
.then(function (resolvedUrl) { | ||
t.is(resolvedUrl, '../patterns/knitwork.gif'); | ||
}, t.fail); | ||
}); | ||
test('baseUrl + loadPaths + relativeTo', function (t) { | ||
@@ -275,37 +171,2 @@ return resolveUrl('picture.png', { | ||
test('currentPath + loadPaths + relativeTo', function (t) { | ||
return resolveUrl('knitwork.gif', { | ||
currentPath: 'fixtures/patterns', | ||
loadPaths: ['fixtures/fonts', 'fixtures/images'], | ||
relativeTo: 'fixtures/fonts' | ||
}) | ||
.then(function (resolvedUrl) { | ||
t.is(resolvedUrl, '../patterns/knitwork.gif'); | ||
}, t.fail); | ||
}); | ||
test('basePath + baseUrl + currentPath + loadPaths', function (t) { | ||
return resolveUrl('knitwork.gif', { | ||
basePath: 'fixtures', | ||
baseUrl: 'http://example.com/wp-content/themes', | ||
currentPath: 'patterns', | ||
loadPaths: ['fonts', 'images'] | ||
}) | ||
.then(function (resolvedUrl) { | ||
t.is(resolvedUrl, 'http://example.com/wp-content/themes/patterns/knitwork.gif'); | ||
}, t.fail); | ||
}); | ||
test('basePath + baseUrl + currentPath + relativeTo', function (t) { | ||
return resolveUrl('knitwork.gif', { | ||
basePath: 'fixtures', | ||
baseUrl: 'http://example.com/wp-content/themes', | ||
currentPath: 'patterns', | ||
relativeTo: 'fonts' | ||
}) | ||
.then(function (resolvedUrl) { | ||
t.is(resolvedUrl, '../patterns/knitwork.gif'); | ||
}, t.fail); | ||
}); | ||
test('basePath + baseUrl + loadPaths + relativeTo', function (t) { | ||
@@ -323,27 +184,2 @@ return resolveUrl('picture.png', { | ||
test('basePath + currentPath + loadPaths + relativeTo', function (t) { | ||
return resolveUrl('knitwork.gif', { | ||
basePath: 'fixtures', | ||
currentPath: 'patterns', | ||
loadPaths: ['fonts', 'images'], | ||
relativeTo: 'fonts' | ||
}) | ||
.then(function (resolvedUrl) { | ||
t.is(resolvedUrl, '../patterns/knitwork.gif'); | ||
}, t.fail); | ||
}); | ||
test('basePath + baseUrl + currentPath + loadPaths + relativeTo', function (t) { | ||
return resolveUrl('knitwork.gif', { | ||
basePath: 'fixtures', | ||
baseUrl: 'http://example.com/wp-content/themes', | ||
currentPath: 'patterns', | ||
loadPaths: ['fonts', 'images'], | ||
relativeTo: 'fonts' | ||
}) | ||
.then(function (resolvedUrl) { | ||
t.is(resolvedUrl, '../patterns/knitwork.gif'); | ||
}, t.fail); | ||
}); | ||
test('absolute basePath + relativeTo', function (t) { | ||
@@ -350,0 +186,0 @@ return resolveUrl('images/picture.png', { |
Sorry, the diff of this file is not supported yet
65430
802
238