-
-
Notifications
You must be signed in to change notification settings - Fork 13
CSS Minify just adds a link to the original file #87
Comments
Could you provide example code? |
Upon further inspection, if the CSS file is saved locally on my machine, it works as expected, there is no issue. However, if the files reside on a remote machine on my network, then that is when I get the I attached a bootstrap.css file that I have on a virtual pc, and the minified version that was created using your extension when I opened the css file in VSCode on my main PC. This also happens when the files reside on a different server on our network. |
To import CSS you need to specify a URL, that includes a protocol. To import files from a filesystem, you could do something like this: @import 'path/to/file'; To import from a url: @import url(<url-to-file>); |
The problem is that I'm not wanting to import. I want the extension to minify the css file that I am working on. However, if I'm using VSCode on my machine, and I open a CSS file that is saved on a remote server/pc on my network, when I minify the CSS file the extension does not minify the file. The .min.css file that is created by the extension is not minified. Rather the extension only writes an import to the existing .css. This behavior does not happen when I roll back the extension to a previous version. |
Have you changed any settings related to css? I have a hard time debugging this since I don't have any network drives set up and I use Linux which does not mount network drives in the same way. |
Answers below:
The only setting that I have changed is:
Not sure what this means.
I tried both v3.0.3 and v3.0.1 and they both work correctly |
Thank you very much.
My mistake. Not meant to be included 🤷♂️ I think I know what's going on now. Before I have a silly workaround that should work in the meantime: |
I will try to take a close look when I get home for the weekend. |
We use UNC paths to access web applications that are hosted on various network servers. We do not want to have to map each server to a drive letter. (This will overload available drive letters and modify the auditing that we have in place which monitors file save paths.) I'm currently using 3.2.2 and the JS minification and source map generation appears to work correctly, but CSS minification is useless as all it does is generate an invalid include. Our hostnames are not IP addresses. We use internal hostnames like I know that the CSS minification is treated a differently than JS, but HookyQR VSCodeMinify works correctly with CSS despite the file being saved to on a Windows UNC path. |
Same problem here with version 3.3.2, but I think I may have understood the issue. As of now es6-css-minify sends to cleancss the file path like below if the file is in a samba share:
but it should instead check if the file is a samba folder (meaning the file is local and not remote), and add the "file:///" protocol prefix to it in such a case before to forward the request to cleancss. This can be done by checking if the first two characters of a path are "//", and than appending the string "file:///" to it.
If I am not mistaken, Nodejs URL module actually provides a function to do that, called url.pathToFileURL(path). Link to the docs: https://nodejs.org/api/url.html#url_url_pathtofileurl_path. This behaviour happens because cleancss believes that the resource is remote, but no protocol to fetch it is specified.
olback, do you think you may be willing to implement such a bugfix? I think the fix could be implemented nearby Line 47 in 9f2fe24
Hopefully, it should be enough to import the URL module and do something like:
|
Hey @jhack-jos Do your |
Has there been any progress on this bug? |
No. See #140. |
Describe the bug
In Version 3.1.1:
When I minify a CSS file, the minified file is just
@import url(<//<filepath>/<filename>.css)
to the original file. The output window displays the following:To Reproduce
Steps to reproduce the behavior:
@import
to the original file.Expected behavior
A truly minified file. I rolled the extension back to version 3.0.3 and the minification works as expected.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: