question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using @import with relative path and dotless.Core.Less.Parse

See original GitHub issue

In our system we have a scenario where we need to use…

dotless.Core.Less.Parse(LESSInputAsString, config)

The problem here is that if LESSInputAsString contains a @import statement we need to force dotLESS to look for these imports relative to a specific folder.

Each “template” in our system generates it’s own supporting files directory and this is where any additional .less files would be kept. We need to point dotLESS to this folder and have it look there (or at least start there for relative paths) when using @import

Issue Analytics

  • State:closed
  • Created 12 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
lukeapagecommented, Jan 25, 2012

Yes, I think it should be configurable, so keep this bug open.

If all your less files are stored in the database you could create your own virtual file system accessor like the unit tests do - then less wouldn’t have to access the file system at all.

0reactions
rnorbauercommented, Mar 28, 2014

Might it be possible to get some example syntax for how one would use this CurrentDirectory configuration option? I have no problem sub-classing and overriding the method, but I’m not sure what to do with my resulting IImporter object so I eventually build up to an object with a Parse method that gives me back a string. :S

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Parse of '@import (less)' statement raises ...
NET MVC 5 Project with dotLess 1.4.1. Attempt to use @import (less) statement inside of a simple less file, that only imports a...
Read more >
Resolving relative paths for @import and @insert directives ...
I just committed a new version that sets the current workingdirectory to the file's path so all imports are relative to the .less...
Read more >
Setup dotLess CSS In ASP.NET MVC Project
In this article you will learn how to create and setup dotLess ... Add your .less file to your project and reference that...
Read more >
Adding LESS support to the ASP.NET Optimization Framework
We now need to create an IPathResolver implementation that can convert both absolute and relative paths into virtual paths. This is necessary ...
Read more >
LESS - Quick Guide
It is used to import the contents of the LESS or CSS files. Example. The following example demonstrates the use of importing in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found