Weird import bug with --resolve-url? Not getting any CSS output #2119

Closed
thybzi opened this Issue Feb 22, 2016 · 7 comments

Projects

None yet

2 participants

@thybzi
thybzi commented Feb 22, 2016

I have the following file structure (minimal set to reproduce bug):

styl
|-- _base
|   `-- test
|       |-- index.styl
|       |-- main.styl
|       `-- vars.styl
|-- mobile
|   `-- test
|       |-- index.styl
|       |-- main.styl
|       `-- vars.styl
`-- mobile.styl

And the files content:

_base/test/index.styl and mobile/test/index.styl:

@import 'vars'
@import 'main'

_base/test/main.styl and _base/test/vars.styl:
no matter, may be even empty.

mobile/test/test.styl

@import '../../_base/test/main'
.test
  color: red

mobile/test/vars.styl

@import '../../_base/test/vars'

mobile.styl

@import 'mobile/test'

All the @import constructs may be changed to @require, that doesn't change the thing. Which is:

When I compile mobile.styl to mobile.css with --resolve-url flag, the output is empty (no error, but just nothing is output)

Now, if I remove import line from mobile/test/vars.styl (which imports _base/test/vars.styl), I can see my output in CSS file!

And if I change import lines order in mobile/test/index.styl (putting main first and vars second), I also can see my output in CSS file!

.test {
  color: #f00;
}

What is the trick? Why auxiliary import prevents my .styl file to output any CSS? Looks very weird.

@Panya
Member
Panya commented Feb 22, 2016

I can't reproduce it with Stylus 0.53.0 (the latest version, CLI). Maybe you're using some flags or plugins?

@thybzi
thybzi commented Feb 22, 2016

Whoa, completely right idea! Yes, I've checked the flags, and it ONLY reproduces with --resolve-url!
(Also using CLI Stylus 0.53.0)

@thybzi thybzi changed the title from Weird import bug? Not getting any CSS output to Weird import bug with --resolve-url? Not getting any CSS output Feb 22, 2016
@thybzi
thybzi commented Feb 22, 2016

I've changed the issue title and the head post to mention --resolve-url

@Panya
Member
Panya commented Feb 22, 2016

Yep, it's known issue, try to use --resolve-url-nocheck instead, it should work the same way but without this unexpected behavior.

@thybzi thybzi referenced this issue in gruntjs/grunt-contrib-stylus Feb 22, 2016
Closed

Support --resolve-url-nocheck #146

@thybzi
thybzi commented Feb 22, 2016

Is there any duplicate issue about that, which I should watch?
Or this --resolve-url-nocheck is not temporary but the final solution?

@Panya
Member
Panya commented Feb 22, 2016

It will be the default behavior for --resolve-url in 1.0, so yep, it's final.

@Panya Panya closed this Feb 22, 2016
@thybzi
thybzi commented Feb 22, 2016

Thank you for the help!
And I confirm that using --resolve-url-nocheck fixes my situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment