-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Google fonts are imported, break HTTPs when protocol relative #632
Comments
That's a good point indeed. The only way to stop it (so far) is to use |
My workaround for now is to set HTTPs for loading font. So on font-face contains https link and it does not break production code. Possible solution:
By searching in the repository I found https:/petetak/clean-css/blob/698efdc1a387706ebfb36178677e539280e8abc4/test/unit-test.js#L770 . I don't find theses tests in the current code base. I am new to this project. Thanks |
I'll think of the best approach here, it could be even a combination of those. Re that unit test, it's from an old version of clean-css when there was no remote importing at all, so all such URLs were kept intact. Stay tuned for updates! |
This refers to #632, but just confirms we do the right thing.
With `processRemoteImport: false` / `--skip-remote-import` one can entirely skip remote `import` processing.
I found out the reason you see URLs changed from I added two features you suggested on a branch https:/jakubpawlowicz/clean-css/tree/632-remote-import which will likely make to master. The syntax is as follows: API: To skip all remote imports: API: Does it makes sense? |
Thanks for your work!
API:
|
I think you have a fair point. How about adding some special keywords, like |
With `processRemoteImport: false` / `--skip-remote-import` one can entirely skip remote `import` processing.
@LoicMahieu what's more, we'd need to go with an extra option, e.g. I would keep |
Adds an option to skip importing of specific URLs. So far we only had an option to skip inlining of all imports, but with this commit a fine-grained control is added, e.g. import from all but fonts.googleapis.com: API: `new CleanCSS({ processImportFrom: ['!fonts.googleapis.com'] })` CLI: `cleancss --skip-import-from fonts.googleapis.com` To skip all local imports: API: `new CleanCSS({ processImportFrom: ['!local'] })` CLI: `cleancss --skip-import-from local` To skip certain local and all remote imports: API: `new CleanCSS({ processImportFrom: ['!path/to/file', '!remote'] })` CLI: `cleancss --skip-import-from path/to/file,remote`
So far we only had an option to skip inlining of all imports, but with this commit a fine-grained control is added, e.g. import from all but fonts.googleapis.com: API: `new CleanCSS({ processImportFrom: ['!fonts.googleapis.com'] })` CLI: `cleancss --skip-import-from fonts.googleapis.com` To skip all local imports: API: `new CleanCSS({ processImportFrom: ['!local'] })` CLI: `cleancss --skip-import-from local` To skip certain local and all remote imports: API: `new CleanCSS({ processImportFrom: ['!path/to/file', '!remote'] })` CLI: `cleancss --skip-import-from path/to/file,remote`
So far we only had an option to skip inlining of all imports, but with this commit a fine-grained control is added, e.g. import from all but fonts.googleapis.com: API: `new CleanCSS({ processImportFrom: ['!fonts.googleapis.com'] })` CLI: `cleancss --skip-import-from fonts.googleapis.com` To skip all local imports: API: `new CleanCSS({ processImportFrom: ['remote'] })` CLI: `cleancss --skip-import-from local` To skip certain local and all remote imports: API: `new CleanCSS({ processImportFrom: ['local', '!path/to/file'] })` CLI: `cleancss --skip-import-from remote,path/to/file`
I have just merged this change to master. The API is as you suggested with the exception of |
It's just been released with clean-css 3.4. 🎆 Thanks @LoicMahieu for all valuable input! |
Awesome ! Thanks @jakubpawlowicz |
Google fonts
@import
are resolved. Anyway it works when imported. The problem is, you can not keep URLs as protocol relative.Consider:
which output:
You notice that
src
url is in HTTP. It obviously break application when hosted in production, under HTTPs.My question:
It will keep my url with protocol relative.
Thanks for response and thanks to contributors for this so useful module!
The text was updated successfully, but these errors were encountered: