Skip to content

Commit

Permalink
Add "resolve url nocheck". Fixes #146
Browse files Browse the repository at this point in the history
  • Loading branch information
thybzi committed Feb 22, 2016
1 parent fbf0d4c commit 7c3efd2
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ module.exports = function(grunt) {
'resolve url': true
}
},
resolveUrlNocheck: {
files: {
'tmp/resolveUrlNocheck.css': 'test/fixtures/resolveUrlNocheck/resolveUrlNocheck.styl'
},
options: {
'resolve url nocheck': true
}
},
import: {
files: {
'tmp/import.css': 'test/fixtures/import/import.styl'
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ _All urls are resolved relatively to position of resulting `.css` file_

( **NOTICE:** the object key contains a space `"resolve url"` and Stylus resolves the url only if it finds the provided file )

#### [resolve url nocheck]
Type: `Boolean`
Default: `false`

Like [resolve url](#resolve-url), but without file existence check. Fixes [some current issues](https://github.com/stylus/stylus/issues/2119).

( **NOTICE:** the object key contains spaces `"resolve url nocheck"` )

#### banner
Type: `String`
Default: `''`
Expand Down
8 changes: 8 additions & 0 deletions docs/stylus-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ _All urls are resolved relatively to position of resulting `.css` file_

( **NOTICE:** the object key contains a space `"resolve url"` and Stylus resolves the url only if it finds the provided file )

## resolve url nocheck
Type: `Boolean`
Default: `false`

Like [resolve url(#resolve-url), but without file existence check. Fixing [some current issues](https://github.com/stylus/stylus/issues/2119).

( **NOTICE:** the object key contains two spaces `"resolve url nocheck"` )

## banner
Type: `String`
Default: `''`
Expand Down
2 changes: 2 additions & 0 deletions tasks/stylus.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ module.exports = function(grunt) {
});
} else if (key === 'resolve url') {
s.define('url', stylus.resolver());
} else if (key === 'resolve url nocheck') {
s.define('url', stylus.resolver({nocheck: true}));
} else {
s.set(key, value);
}
Expand Down
1 change: 1 addition & 0 deletions test/expected/resolveUrlNocheck/resolveUrlNocheck.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
body{background:url("../test/fixtures/resolveUrlNocheck/child/child.png")}
2 changes: 2 additions & 0 deletions test/fixtures/resolveUrlNocheck/child/both.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import 'vars.styl'
@import 'child.styl'
2 changes: 2 additions & 0 deletions test/fixtures/resolveUrlNocheck/child/child.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
body
background: url("child.png")
1 change: 1 addition & 0 deletions test/fixtures/resolveUrlNocheck/child/vars.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import '../other/vars.styl'
Empty file.
Empty file.
1 change: 1 addition & 0 deletions test/fixtures/resolveUrlNocheck/resolveUrlNocheck.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "child/both.styl"
9 changes: 9 additions & 0 deletions test/stylus_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,15 @@ exports.stylus = {

test.done();
},
resolveUrlNocheck: function(test) {
test.expect(1);

var actual = readFile('tmp/resolveUrlNocheck.css');
var expected = readFile('test/expected/resolveUrlNocheck/resolveUrlNocheck.css');
test.equal(expected, actual, 'should resolve import urls without existence check');

test.done();
},
relativeDestIn: function(test) {
test.expect(1);

Expand Down

0 comments on commit 7c3efd2

Please sign in to comment.