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

LESS compiler does not resolve imports with relative paths #2

Open
I3undy opened this issue Nov 30, 2015 · 7 comments
Open

LESS compiler does not resolve imports with relative paths #2

I3undy opened this issue Nov 30, 2015 · 7 comments

Comments

@I3undy
Copy link
Member

I3undy commented Nov 30, 2015

Dunross created on Sep 15, 2013:
https://combinator.codeplex.com/workitem/53

Sample scenario: Download Bootstrap as LESS files and try to load it using Combinator LESS file support. It reports "You are importing a file ending in .less that cannot be found."

The reason is that all imports in Bootstrap have relative paths (otherwise it would not be usable in all installations), but the LESS compiler isn't configured to set the "current directory" to the compiled file location.

It needs to be configured.

@I3undy
Copy link
Member Author

I3undy commented Nov 30, 2015

@Piedone commented on Sep 16, 2013:

It seems settings the directory is not trivial: dotless/dotless#204 I'll take a look but if you have a solution already don't keep it to yourself :-) (the DotLess code in Combinator is very simple, see LessPreprocessor).

@I3undy
Copy link
Member Author

I3undy commented Nov 30, 2015

Dunross commented on Sep 16, 2013 :

Yep, it appears to be nontrivial.. :-/ I haven't made a fix unfortunately - I precompile the LESS files in other tools instead. It would be nice to have it working, but I'm too busy working on other modules now.. :-(

@I3undy
Copy link
Member Author

I3undy commented Nov 30, 2015

@Piedone commented on Sep 16, 2013:

Could you describe what exactly the code you're trying is and how it fails? Because I tried just now and it work as expected:

@import "Folder/Test";

This imports the less file under Folder/Test.less.

The only gotcha is that you have to import files without the .less extension added to the path for some reason. If you're using bootstrap.less directly this means you have to provide an alternative version where the .less extensions are stripped, but that's it.

Another issue is BTW that there's no released version of DotLess with Less 1.4 support yet... This also means no Bootstrap 3 usable. Speaking of Bootstrap you might want to take a look at this: https://github.com/Lombiq/Pretty-Good-Bootstrap-Base-Theme

@I3undy
Copy link
Member Author

I3undy commented Nov 30, 2015

Dunross commented on Sep 16, 2013:

aha, lol, I haven't tried to import it without extensions... :-) However, if there isn't support for BS 3.0, I cannot use it anyway.. :-( But thanks for the investigation!

@I3undy
Copy link
Member Author

I3undy commented Dec 1, 2015

@Piedone commented on Sep 16, 2013:

I'll update DotLess once it's released.

@I3undy
Copy link
Member Author

I3undy commented Dec 1, 2015

MattGC commented on May 29, 2015:

Seems a shame that we are still left waiting for a fix.

For now, could we simply look for @import in the string being parsed and replace with the HostingEnvironment.MapPath(importpath)? That seems to work fine unless I'm missing something.

Matt

@I3undy
Copy link
Member Author

I3undy commented Dec 1, 2015

kerray commented on Sep 30, 2015:

I'm attempting to use Bootstrap's .less files contained in PJS.Bootstrap, but importing relative paths still fails, and I can't even do it when I strip the ".less" part of the imports... any news on this front please?

LombiqBot pushed a commit that referenced this issue Jun 12, 2016
Issue/btlr 63

--HG--
branch : dev
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

1 participant