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

Relative imports don't work if no from option given #10

Closed
lboecker opened this issue Nov 19, 2014 · 5 comments
Closed

Relative imports don't work if no from option given #10

lboecker opened this issue Nov 19, 2014 · 5 comments

Comments

@lboecker
Copy link

Let's assume the following project structure:

  • ./gulpfile.js
  • ./css/main.css
  • ./css/lists.css

main.css contains the following line: @import "lists.css";

This currently doesn't work without passing { path: ['css'] } to postcss-import. This is probably related to #7, but I feel like relative imports should just work despite of what postcss-import does after it decided that it's not a relative import (e.g., look for node_modules/lists.css/ or something like that).

@MoOx
Copy link
Contributor

MoOx commented Nov 19, 2014

If you look at fixtures, relative import are supposed to work (if you have provide the from option into postcss).
I use postcss-import without any path option & relative import work for me. That being said, I'll take a second look asap since tests use a path.
And the readme should mention the fact that from option helps to make relative import works.
Can you tell me if you use from option or not ?

@lboecker
Copy link
Author

@MoOx My bad, I didn't know the from option even existed. I use the path array and it seems to be doing pretty much the same thing.

Looks like the import plugin prepends the from path to it's path array. I think it's a good idea to just prepend the current stylesheet's parent directory as well.

@MoOx
Copy link
Contributor

MoOx commented Nov 19, 2014

We don't have the current stylesheet information since postcss process css string. That's why we use from option.

@lboecker
Copy link
Author

Makes sense. You may want to explicitly point this out in the readme so that folks like me don't bug you with issues all day. :P Keep up the good work.

@MoOx
Copy link
Contributor

MoOx commented Nov 19, 2014

I'll let that issue open to remind me that ;)

@MoOx MoOx reopened this Nov 19, 2014
@MoOx MoOx changed the title Relative imports don't work Relative imports don't work if no from option given Nov 19, 2014
@MoOx MoOx closed this as completed in 786f5c3 Nov 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants