Bug: @import directive in a .less file fires an exception #3

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
5 participants
Contributor

uluhonolulu commented Mar 1, 2012

The problem is that in the default configuration, dotLess cannot find the file to be imported. This fix tells dotLess how to find the file. Note: you'll have to reference System.Web (or apply a smarter fix, mine is quite dirty I admit).

mkmurray commented Mar 1, 2012

I believe the design is that you would use asset config files instead to handle LESS dependencies. Having said that, one of my coworkers has been working on a pull request that could parse the @import statements and auto populate the asset config file dependencies programmatically for you at runtime.

Contributor

jmarnold commented Mar 1, 2012

@mkmurray You guys wanna take that one to the discussion group (regarding the import statements populating the asset pipeline)? I think that warrants a deeper discussion.

Contributor

ahjohannessen commented Mar 1, 2012

Yep, agree.

@uluhonolulu Mike is correct saying that the current design is that you would use asset config files instead of @import - This is of course problematic with external libs like twitter bootstrap that has like 30 @import statements in the bootstrap.less file.

I am glad that you have solved your issue :) However, I think we need a better solution that is OWIN & bottles friendly plus does not require dependencies on the monster objects.

One approach is the to have a transformer that parses @import statements for each less asset and reads the content of the file in place. Not sure how that flies with the internal model of less.

Contributor

uluhonolulu commented Mar 1, 2012

Yes, I was feeling sacrilegious when I wrote HttpContext.Current, but it was intended as a pointer to the correct solution. Isn't there something like Assets.MapPath method in the Asset pipeline? I mean, if you can write a transformer that reads the content of the file in place, then you know how to get the physical path of the imported file, then you know how to communicate this path to dotLess, then dotLess can perform the import for you.

Hope this makes sense.

mkmurray commented Mar 1, 2012

But then the imported files don't have the opportunity to go through the asset pipeline. What if I want transformations to happen on the imported files?

Contributor

uluhonolulu commented Mar 1, 2012

Agreed.

But I'm still curious about this Asset.MapPath method..

uluhonolulu closed this Mar 1, 2012

mkmurray commented Mar 1, 2012

Yes, I certainly do not want to squash any curiosity or exploration. :)

Contributor

CoreyKaylor commented Mar 1, 2012

Bob is exploring asset activation that would give you easy hooks to parse and populate the asset pipeline dependencies with regard to require.js, it might be applicable for less and sass as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment