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

Allow less imports of paths like 'dir/css' #2955

Merged
merged 2 commits into from
Dec 21, 2016

Conversation

maxbrunsfeld
Copy link
Contributor

Right now, an import like @import "directory/css"; is interpreted as a CSS import, because the path contains /css.

Based on #2364 (comment), it seems that the intent is to create a CSS import if the word css appears as a URL parameter. But appearing after a forward slash doesn't indicate a URL parameter; it just indicates a path.

An alternative would be to parse the import path using url.parse and to look for css in the query string or the hash. Please let me know what solution you'd prefer, and I'll adjust as needed.

Refs #2364

@maxbrunsfeld
Copy link
Contributor Author

maxbrunsfeld commented Aug 25, 2016

I see there's a test that asserts that this:

@import url(http://fonts.googleapis.com/css?family=Open+Sans);

should result in a CSS import, because the path contains the word css. It seems weird to me to interpret the import differently based on its path, but if this behavior is important to preserve, what do you think about making it only happen for urls, not for paths like languages/css?

@matthew-dean
Copy link
Member

It does seem like a very odd hack. I wonder if this was just added for Google Fonts support. Even if it is, it seems like it would too easily have side effects like what you describe. So I agree that this behavior should be adjusted, and the Google Font support can probably be included in a different way.

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

Successfully merging this pull request may close these issues.

None yet

2 participants