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

Pipeline : minified CSS file altered and not applied #2958

Closed
iamalexm opened this issue Jul 8, 2020 · 4 comments
Closed

Pipeline : minified CSS file altered and not applied #2958

iamalexm opened this issue Jul 8, 2020 · 4 comments

Comments

@iamalexm
Copy link

iamalexm commented Jul 8, 2020

When I activate the css_pipeline and css_minify, the css file is properly created but not applied on the website.

system.yaml

assets:
  css_pipeline: true
  css_minify: true
  css_rewrite: false

My Website when I activate the minify option:
image

My head stylesheet link :
image

My source with devtools :
image

But then when I give a closer look to the CSS file, it seems to be altered. Look to the @ import url, sometime the letter "u" disapear. (It's not the full code, only the first few lines)

@import url(//hello.myfonts.net/count/3b748a);@import u;@import url(https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,300;0,700;1,400;1,700&display=swap);rl("https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;
rl(https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,300;0,700;1,400;1,700&display=swap);0,700;1,400&family=PT+Sans&display=swap");@font-face{font-family:"NoahHead-Light";src:url(../assets/fonts/webFonts/NoahHead-Light/font.woff2) format("woff2"),url(../assets/fonts/webFonts/NoahHead-Light/font.woff) format("woff")}@font-face{font-family:"NoahHead-UltraLight";src:url(../assets/fonts/webFonts/NoahHead-UltraLight/font.woff2) format("woff2"),url(../assets/fonts/webFonts/NoahHead-UltraLight/font.woff) format("woff")}@font-face{font-family:"NoahHead-ExtraBold";src:url(../assets/fonts/webFonts/NoahHead-ExtraBold/font.woff2) format("woff2"),url(../assets/fonts/webFonts/NoahHead-ExtraBold/font.woff) format("woff")}@font-face{font-family:"Noah-Bold";src:url(../assets/fonts/webFonts/Noah-Bold/font.woff2) format("woff2"),url(../assets/fonts/webFonts/Noah-Bold/font.woff) format("woff")}@font-face{font-family:"NoahHead-Heavy";src:url(../assets/fonts/webFonts/NoahHead-Heavy/font.woff2) format("woff2"),url(../assets/fonts/webFonts/NoahHead-Heavy/font.woff) format("woff")}*{margin:0;padding:0;-webkit-box-sizing:border-box;box-sizing:border-box}*::-moz-selection{background:#95bbd3}*::selection{background:#95bbd3}html{font-size:62.5%;scroll-behavior:smooth}

There are a lot of differences with the minified file generated by sass

@import url("//hello.myfonts.net/count/3b748a");@import url("https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,700;1,400;1,700&display=swap");@import url("https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,300;0,700;1,400&family=PT+Sans&display=swap");@font-face{font-family:"NoahHead-Light";src:url("../assets/fonts/webFonts/NoahHead-Light/font.woff2") format("woff2"),url("../assets/fonts/webFonts/NoahHead-Light/font.woff") format("woff")}@font-face{font-family:"NoahHead-UltraLight";src:url("../assets/fonts/webFonts/NoahHead-UltraLight/font.woff2") format("woff2"),url("../assets/fonts/webFonts/NoahHead-UltraLight/font.woff") format("woff")}@font-face{font-family:"NoahHead-ExtraBold";src:url("../assets/fonts/webFonts/NoahHead-ExtraBold/font.woff2") format("woff2"),url("../assets/fonts/webFonts/NoahHead-ExtraBold/font.woff") format("woff")}@font-face{font-family:"Noah-Bold";src:url("../assets/fonts/webFonts/Noah-Bold/font.woff2") format("woff2"),url("../assets/fonts/webFonts/Noah-Bold/font.woff") format("woff")}@font-face{font-family:"NoahHead-Heavy";src:url("../assets/fonts/webFonts/NoahHead-Heavy/font.woff2") format("woff2"),url("../assets/fonts/webFonts/NoahHead-Heavy/font.woff") format("woff")}*{margin:0;padding:0;-webkit-box-sizing:border-box;box-sizing:border-box}*::-moz-selection{background:#95bbd3}*::selection{background:#95bbd3}

And in the devtools at a certain point, the code becomes white and stays white until the end. Is this why it is not properly interpreted by the browsers?
image

@iamalexm iamalexm changed the title Pipeline : minifyed CSS file altered and not applied Pipeline : minified CSS file altered and not applied Jul 8, 2020
@ricardo118
Copy link
Contributor

usually this is caused by some improper syntax in one of the css files

@rhukster
Copy link
Member

rhukster commented Jul 8, 2020

first what version of Grav is this?

second, is it possible to get a mini version of your site? something i can test to recreate this? it really only needs the css files and the theme or at least the bit where you include the various css files.

@iamalexm
Copy link
Author

iamalexm commented Jul 8, 2020

I use grav 1.7.0-rc.13

@rhukster I gave you access to my repo so you can have a look

rhukster added a commit that referenced this issue Jul 8, 2020
Signed-off-by: Andy Miller <rhuk@mac.com>
@rhukster
Copy link
Member

rhukster commented Jul 8, 2020

Ok turns out it was some bad regex getting caught up with the ; in your import statements.

@rhukster rhukster closed this as completed Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants