Skip to content
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

Prevent remote URL rebase #679

Closed
bassarisse opened this issue Sep 22, 2015 · 17 comments
Closed

Prevent remote URL rebase #679

bassarisse opened this issue Sep 22, 2015 · 17 comments
Labels

Comments

@bassarisse
Copy link

Hi!

Is there a way to prevent remote URL from being rebased? I can't figure that out on the docs.
I'm not referring to @ imports (the processImportFrom option would be enough), but normal resource definition (for images, etc.).

Prevent this:

background-image: url(http://domain.com/img/image.png);

From turning something like this:

background-image: url(../img/image.png);

Maybe I'm missing some information here...

Thanks!

@bassarisse
Copy link
Author

Bringing some more information about my problem.

I have a remote stylesheet @ imported (and I intent to include the content of this stylesheet), and it contains remote resource definitions. These resources get rebased. How can I prevent that?

@jakubpawlowicz
Copy link
Collaborator

is it any similar to https:/jakubpawlowicz/clean-css/blob/master/test/protocol-imports-test.js#L181? What version of clean-css are you running?

@JeroenVanOort
Copy link

I seem to have a similar problem:

We have an CSS file like this:

@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic);

But the rebase seems to go wrong as the output is url(../../fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGLsbIrGiHa6JIepkyt5c0A0.ttf). I do know it has worked with version 3.4.1. Now running 3.4.4.

Is this the desired functionality?

@chopfitzroy
Copy link

👍

@obenjiro
Copy link

obenjiro commented Oct 1, 2015

Did you tried "--skip-rebase" flag ? It's not a perfect solution but may help for now.

@ginovva320
Copy link

Setting rebase to false when using the API resolves the issue for me, but is obviously less than ideal.

@bassarisse
Copy link
Author

I'm using the last stable version, 3.4.5.

The option --skip-rebase disables all rebasing, AFAIK. I just needed to disable remote url rebasing. Does it makes sense?

I think options like --skip-rebase-from [rules] and rebaseFrom (that worked like the ones to selectively process @imports), would be a good fit.

@jakubpawlowicz
Copy link
Collaborator

@bassarisse @JeroenVanOort could you please share a short CSS snippet which replicates this bug? I'm struggling with replicating this issue.

@kouki-o
Copy link

kouki-o commented Oct 9, 2015

@jakubpawlowicz

3.4.5(current version)

  • install clean-css
$ npm install -g clean-css
  • write test.css
@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic);
  • execute command
$ cleancss test.css
  • Output
@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:300;src:local('Source Sans Pro Light'),local('SourceSansPro-Light'),url(../../fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGMw1o1eFRj7wYC6JbISqOjY.ttf) format('truetype')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:400;src:local('Source Sans Pro'),local('SourceSansPro-Regular'),url(../../fonts.gstatic.com/s/sourcesanspro/v9/ODelI1aHBYDBqgeIAH2zlNzbP97U9sKh0jjxbPbfOKg.ttf) format('truetype')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:600;src:local('Source Sans Pro Semibold'),local('SourceSansPro-Semibold'),url(../../fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGNNE-IuDiR70wI4zXaKqWCM.ttf) format('truetype')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:700;src:local('Source Sans Pro Bold'),local('SourceSansPro-Bold'),url(../../fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGLsbIrGiHa6JIepkyt5c0A0.ttf) format('truetype')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:300;src:local('Source Sans Pro Light Italic'),local('SourceSansPro-LightIt'),url(../../fonts.gstatic.com/s/sourcesanspro/v9/fpTVHK8qsXbIeTHTrnQH6Iue0YgdIF4L_q7PS4yTQOQ.ttf) format('truetype')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:400;src:local('Source Sans Pro Italic'),local('SourceSansPro-It'),url(../../fonts.gstatic.com/s/sourcesanspro/v9/M2Jd71oPJhLKp0zdtTvoM0DauxaEVho0aInXGvhmB4k.ttf) format('truetype')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:600;src:local('Source Sans Pro Semibold Italic'),local('SourceSansPro-SemiboldIt'),url(../../fonts.gstatic.com/s/sourcesanspro/v9/fpTVHK8qsXbIeTHTrnQH6EfrksRSinjQUrHtm_nW72g.ttf) format('truetype')}
  • url(../../fonts.gstatic.com/... is strange

3.4.1

$ npm install -g [email protected]
  • run the above described procedure. (write test.css/execute command)
  • Output
@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:300;src:local('Source Sans Pro Light'),local('SourceSansPro-Light'),url(https://fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGMw1o1eFRj7wYC6JbISqOjY.ttf) format('truetype')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:400;src:local('Source Sans Pro'),local('SourceSansPro-Regular'),url(https://fonts.gstatic.com/s/sourcesanspro/v9/ODelI1aHBYDBqgeIAH2zlNzbP97U9sKh0jjxbPbfOKg.ttf) format('truetype')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:600;src:local('Source Sans Pro Semibold'),local('SourceSansPro-Semibold'),url(https://fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGNNE-IuDiR70wI4zXaKqWCM.ttf) format('truetype')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:700;src:local('Source Sans Pro Bold'),local('SourceSansPro-Bold'),url(https://fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGLsbIrGiHa6JIepkyt5c0A0.ttf) format('truetype')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:300;src:local('Source Sans Pro Light Italic'),local('SourceSansPro-LightIt'),url(https://fonts.gstatic.com/s/sourcesanspro/v9/fpTVHK8qsXbIeTHTrnQH6Iue0YgdIF4L_q7PS4yTQOQ.ttf) format('truetype')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:400;src:local('Source Sans Pro Italic'),local('SourceSansPro-It'),url(https://fonts.gstatic.com/s/sourcesanspro/v9/M2Jd71oPJhLKp0zdtTvoM0DauxaEVho0aInXGvhmB4k.ttf) format('truetype')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:600;src:local('Source Sans Pro Semibold Italic'),local('SourceSansPro-SemiboldIt'),url(https://fonts.gstatic.com/s/sourcesanspro/v9/fpTVHK8qsXbIeTHTrnQH6EfrksRSinjQUrHtm_nW72g.ttf) format('truetype')}
  • url(https://fonts.gstatic.com/s/... is fine.

@kouki-o
Copy link

kouki-o commented Oct 9, 2015

Changes from 3.4.1 to 3.4.5

I think to do around here is suspicious. (unconfident)

@jakubpawlowicz
Copy link
Collaborator

I can see it now. Fix is coming soon!

jakubpawlowicz added a commit that referenced this issue Oct 14, 2015
There was an edge case when a remote stylesheet pointed to a URL
in a different domain. Introduced in #667.
@jakubpawlowicz
Copy link
Collaborator

Fixed in 3.4.6. Thanks everyone for your help!

@kouki-o
Copy link

kouki-o commented Oct 19, 2015

Thank you!
I was confirm this problem has been fixed at 3.4.6.

@bassarisse
Copy link
Author

Thank you so much!
Sorry for not responding when needed, was on vacation.

@COLABORATI
Copy link

is this already in the npm package pool? I updated gulp-minify-css which uses this packge, but the source seems to stay at 3.4.4 - sorry to ask here, I am not deeply involved into npm package dependency thing, just a user of node tool, but need this fix. What should I do? Thanks!

@COLABORATI
Copy link

ok, I just deleted all the node modules and did a new npm install - now everything is ok. There was some strange mixup of global and local node packages.

@kouki-o
Copy link

kouki-o commented Oct 20, 2015

I tried this command. (doesn't affect other package)

npm uninstall gulp-minify-css
npm install gulp-minify-css

I have understood as "deeply update" is not recommended because large influence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants