This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I was initially happy that the import directive didn't translate to the equivalent CSS import, but when I inspect the result of using imports it seems like I am ending up with a massive amount of duplication. For instance, I have a shared.less that is imported by forms.less, and a site.less which imports both of the former two less files. The result of this is that definitions from shared.less are repeated four times in the output file. About 16kb of less thus results in a 450kb css file (350kb minified), which seems a bit excessive. Is there a way to enable removal of duplicate definitions in the output (or can you possibly add one? :) |
|
|
I believe this is an issue with the Less compiler. The Less compiler isn't under our control; we only handle the Visual Studio integration. You can report issues with the compiler at https://github.com/cloudhead/less.js. If you're able to get it resolved in the compiler let us know and we will update Web Workbench to use the updated compiler! |
|
|
Thanks, I went to search their issue tracker and found a mile long list of open issues :o) This appears to cover the problem: https://github.com/cloudhead/less.js/issues/49 Someone has indeed created a fix and supplied a pull request to have it merged, but this has not yet happened (and from what I can gather, things don't move too fast so there's little hope for an official release any time soon). The fix can be pulled here in case you can be persuaded to provide a custom less compiler with WW (or maybe just provide a mechanism for replacing the one shipping with WW): https://github.com/cloudhead/less.js/pull/431 On another note, wouldn't it make a lot of sense to have a compiler of your own making? One of the big things on the horizon for .NET is a compiler rewrite that allows the IDE and any plugins access the rich metadata it generates when it compiles the source. It seems to be that this would be equally useful for suggestions/completions in WW. |
|
|
We don't really want to fork the Less compiler because it would make maintenance a lot more complex. We can investigate allowing users to plug in their own build of the compiler but that's non-trivial (we do a certain amount of magic to get around Less' dependency on Node.js, and what we do is just enough to get the standard compiler to run), so please don't bank on such a feature arriving soon. The only thing I can really suggest is trying to refactor your imports so that each file gets imported only once into each target file. Inconvenient, I realise, but it's probably the most realistic solution for now. |
|
|
Yes, I've done just that. Had to move all files into the same folder in order for the imported definitions to be available (it looks like Less provides no support for dealing with relative paths). However, it brought the CSS output back to 55kb instead of 450kb. I'm starting to see the limitations of Less, so may need to investigate alternatives for my next project. Thank you for your time and do be sure to mention it in the changelog/release notes if you end up supporting a custom compiler. |
|
|
This isn't supported, and I have not tried it with Less, but this method works for updating the embedded Scss compiler... Goto this folder (or the equivalent for your windows version):
Open Less.zip and update it with your patched version of the compiler. Restart Visual Studio. You'll need to repeat this process each time you upgrade the extension. |
|
|
Thanks, I'll keep this in mind (for now I'm just sticking all files in the same folder and using a single-child hierarchy, which seems to avoid the problems). |
|