https://github.com/jhnns/less-relative-urls-bug
This repository demonstrates a bug in Less when the content is passed via stdin and the `--relative-urls` option is used.
https://github.com/jhnns/less-relative-urls-bug
Last synced: 3 months ago
JSON representation
This repository demonstrates a bug in Less when the content is passed via stdin and the `--relative-urls` option is used.
- Host: GitHub
- URL: https://github.com/jhnns/less-relative-urls-bug
- Owner: jhnns
- Created: 2017-03-09T18:41:16.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-09T18:47:31.000Z (over 8 years ago)
- Last Synced: 2025-01-24T12:13:42.257Z (5 months ago)
- Language: CSS
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# less-relative-urls-bug
This repository demonstrates a bug in [Less](https://github.com/less/less.js) when the content is passed via stdin and the `--relative-urls` option is used.
---
Run `npm run error` to reproduce the problem:
```bash
> [email protected] error /Users/jhnns/dev/temp/less-relative-urls-bug
> cd ./a/a && ../../node_modules/.bin/lessc -ru - < a.less.b {
background-image: url("b/b/test.jpg");
}
```The expected output would be:
```bash
.b {
background-image: url("../../b/b/test.jpg");
}
```---
When the folder is nested only one level deep, however, the output is correct. See `npm run ok`:
```bash
> [email protected] ok /Users/jhnns/dev/temp/less-relative-urls-bug
> cd ./a && ../node_modules/.bin/lessc -ru - < a.less.b {
background-image: url("../b/b/test.jpg");
}
```---
The problem is [somewhere along these lines](https://github.com/less/less.js/blob/43ab0b872248ec34186bd8c245904d9a0f5d7825/lib/less/import-manager.js#L89-L97) and can be reproduced with less `2.x` and `[email protected]`. `alpha.2` is throwing an error:
```
TypeError: Cannot read property 'then' of undefined
at parseLessFile (/Users/jhnns/dev/temp/less-relative-urls-bug/node_modules/less/bin/lessc:287:13)
at ReadStream. (/Users/jhnns/dev/temp/less-relative-urls-bug/node_modules/less/bin/lessc:318:13)
at emitNone (events.js:91:20)
at ReadStream.emit (events.js:188:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
```