SquishIt icon indicating copy to clipboard operation
SquishIt copied to clipboard

EmbeddedResourceResolver does not support .less files

Open LarryBS opened this issue 10 years ago • 7 comments

Since EmbeddedResourceResolver.ResolveFile uses tempPathProvider I see no way how the resolver can support .less files. Are you going to fix it?

Anyway many thanks for your work!

LarryBS avatar Feb 24 '15 06:02 LarryBS

Hmm this is more an oversight than anything else. I think I could take the extensions of the incoming file and bolt them onto the end of the filename. If that works its an easy fix, will give it a shot tonight.

AlexCuse avatar Feb 25 '15 01:02 AlexCuse

Can you try using this nuget package? https://www.nuget.org/packages/SquishIt/0.9.8-beta1

Install using the -pre flag. I think it will work now.

AlexCuse avatar Feb 25 '15 02:02 AlexCuse

Great! So quick. Thank you very much. That is what I supposed to do too. Yes now the Preprocessor will catch a less file.
But am afraid that this is not so simple and it may require more work because of the @imports inside the .less sheets. You see it is anyway a temp path so the imports will not work. Is it possible to use some project relative path or parameter instead of the temp path?

However am going to try it again. Regards!

LarryBS avatar Feb 25 '15 09:02 LarryBS

That would end up being a lot more work because imports are so closely tied to the filesystem.

The best way I can think of offhand to solve the problem would be to use a custom directive eg

@import-embedded "SquishItAspNetMvcTest://EmbeddedResource.Embedded.css"

Then we'd know to use the embedded resource resolver to find that content. This is not an especially easy task though, and debugging support could become a nightmare.

Why do you need to package your .less as an embedded resource?

AlexCuse avatar Feb 25 '15 13:02 AlexCuse

Hi Alex. You see - mostly experimental. I use all the resources in a separate project (dll). Sort of a detached theme. Wouldn't say that it is fully effective but so far works good enough if not using LESS, but I would like to.

Anyway thank you for help very much and best regards!

LarryBS avatar Feb 26 '15 07:02 LarryBS

I thought it might be something like that.

My unsolicited advice in that kind of situation would be to combine your .less as a build step (using bundler, grunt or similar) and include the resulting CSS file in your DLL instead of all your development .less files. That way consumers don't need to worry about having less preprocessors and the like running in their project if they don't need them.

AlexCuse avatar Feb 26 '15 18:02 AlexCuse

Hi Alex I'll think of it by all means. Need to try. Thanks for your help sincerely.

LarryBS avatar Feb 27 '15 09:02 LarryBS