mrcrowl / vscode-easy-less

Easy LESS extension for Visual Studio Code
MIT License
67 stars 23 forks source link

Option 'compress' is ignored for inline imported files #39

Closed OlehRb closed 5 years ago

OlehRb commented 6 years ago

Hi, I have a main less file, let's call it style.less in which I import some other less and css file and compress: true, set in global settings works just fine, until I try to import file, using less option inline, like this:

@import (inline) url('util/opensans.import.css'); Then I end up having style.css, like this: image 2018-06-12 15 11 39

Here a part is my opensans.import.css

@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 300;
    /*src: local('Open Sans Light'), local('OpenSans-Light'), url('../fonts/opensans/opensans-light-webfont.woff2') format('woff2');*/
    src: url("../fonts/OpenSansLight/OpenSansLight.eot");
    src: url("../fonts/OpenSansLight/OpenSansLight.eot?#iefix")format("embedded-opentype"),
    url("../fonts/OpenSansLight/OpenSansLight.woff") format("woff"),
    url("../fonts/OpenSansLight/OpenSansLight.ttf") format("truetype");
}

@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 400;
    /*src: local('Open Sans'), local('OpenSans'), url('../fonts/opensans/opensans-regular-webfont.woff2') format('woff2');*/
    src: url("../fonts/OpenSansRegular/OpenSansRegular.eot");
    src: url("../fonts/OpenSansRegular/OpenSansRegular.eot?#iefix")format("embedded-opentype"),
    url("../fonts/OpenSansRegular/OpenSansRegular.woff") format("woff"),
    url("../fonts/OpenSansRegular/OpenSansRegular.ttf") format("truetype");
}

I also tried to change the extension of the opensans.import.css to less, but it didn't help. Of course it doesn't affect work of my styles, but it also doesn't looks ok.

I wonder, if there is any way to make it this extension to compress inline imported files?

I'm using vscode v1.24.0, easy less v1.4.5

Thanks for any help

mrcrowl commented 5 years ago

I believe that this is a limitation in less.js itself. The compress option that I provide is passed directly through to less.js itself to take care of.

My suspicion is that the less library only applies compression to the output of .less --> .css conversions, rather than on the file output itself.

You could try raising an issue with less.js: https://github.com/less/less.js/issues