Skip to content

Commit 3901c4d

Browse files
author
benholloway
committed
fix readme and minor bug in file location
1 parent 4539e32 commit 3901c4d

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

lib/find-file.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ module.exports = function findFile(startPath, uri) {
5656
* @returns {boolean} True where a package.json or bower.json exists, else False
5757
*/
5858
function testWithinProject(absolutePath) {
59-
return (path.relative(absoluteStart, process.cwd()).charAt(0) === '.');
59+
return (path.relative(absolutePath, process.cwd()).charAt(0) === '.');
6060
}
6161

6262
/**

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "resolve-url-loader",
3-
"version": "1.0.0",
4-
"description": "Webpack loader that resolves an absolute path of url() statements based on the original file",
3+
"version": "1.0.1",
4+
"description": "Webpack loader that resolves relative paths in url() statements based on the original source file",
55
"main": "index.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1"

readme.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
[![NPM](https://nodei.co/npm/resolve-url-loader.png)](http://github.com/bholloway/resolve-url-loader)
44

5-
Webpack loader that rsesolves an absolute path of url() statements based on the original file.
5+
Webpack loader that resolves relative paths in url() statements based on the original source file
66

77
Use in conjunction with the [sass-loader](https://www.npmjs.com/package/sass-loader) and specify your assets relative
8-
to the `sass` file in question. This plugin will use the source-map from the `sass` compiler to locate the original file
8+
to the `sass` file in question. This loader will use the source-map from the `sass` compiler to locate the original file
99
and write a more complete path for your asset. Subsequent build steps can then locate your asset for processing.
1010

1111
## Usage
@@ -57,7 +57,16 @@ module.exports = {
5757
};
5858
```
5959

60-
### Options
60+
## How it works
61+
62+
A [rework](https://github.com/reworkcss/rework) process is run on incoming `css`. The incoming source-map is used to
63+
resolve the original file where there was some preceding transpile step (such as SASS).
64+
65+
Url() statements are identified and a search is begun, commencing at the original file. In some cases there is no
66+
immediate match (<cough>bootstrap</cough>) and we search both deeper and shallower from the starting directory. The
67+
search will proceed until
68+
69+
## Options
6170

6271
* `absolute` Forces the url() to be resolved to an absolute path. This is considered
6372
[bad practice](http://webpack.github.io/docs/how-to-write-a-loader.html#should-not-embed-absolute-paths) so only do it

0 commit comments

Comments
 (0)