Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--import fails if CWD is not same as input file #1863

Open
frostius opened this issue Mar 17, 2015 · 6 comments
Open

--import fails if CWD is not same as input file #1863

frostius opened this issue Mar 17, 2015 · 6 comments
Labels

Comments

@frostius
Copy link

The --import command fails silently unless the CWD is the same as the input file. Examples below.

Import fails with no warning:

stylus --import global.styl nested\file.styl -o nested
stylus --import .\global.styl nested\file.styl -o nested

Import works as expected:

stylus --import ../global.styl file.styl

EDIT: Tested on Win 8.1 v0.50.0

@Panya
Copy link
Member

Panya commented Mar 17, 2015

Cannot reproduce this with the latest version (0.50.0) on Mac.

@Panya
Copy link
Member

Panya commented Mar 21, 2015

I've tested this with Win7, Stylus 0.50.0 and Node 0.12.0. Still can't reproduce.

@frostius
Copy link
Author

I have created a minimal example that reproduces the error. Suggestions on how to share the zip with you? (it's the build scripts plus nested folders/files)

@Panya
Copy link
Member

Panya commented Mar 21, 2015

@mfrost66 send it to panyakor@gmail.com

@Panya
Copy link
Member

Panya commented Mar 21, 2015

Ah, I see. The --import path is resolved relative to the compiled file lib\my-element\my-element.styl and not to cwd dir. So, in badBuild.cmd you're importing vars.styl inside lib\my-element dir (and not .\vars.styl). To achieve goodBuild.cmd behavior you should write:
stylus --inline --import ..\..\vars.styl lib\my-element\my-element.styl -o lib\my-element

@frostius
Copy link
Author

It's good to know what the issue is. It was failing intermittently for me as it depends on the CWD and whether the CWD has a matching filename.

In my script, I process a tree of stylus files where the global --import file is the same file. The current implementation requires that I modify the import file path to be relative to the file being processed.

At minimum, it would be good to note this in the --help documentation. Also, FYI, the "executable" portion of your web site (http://learnboost.github.io/stylus/docs/executable.html) is hard to read as the fixed width section prevents reading the content without horz scrolling.

@kizu kizu added the s: Docs label Sep 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants