google / WebFundamentals

Former git repo for WebFundamentals on developers.google.com
Apache License 2.0
13.85k stars 2.57k forks source link

CSS min/concat with usemin refers to wrong paths, doesn't work #300

Closed PaulKinlan closed 10 years ago

PaulKinlan commented 10 years ago

Issue by ianbarber Wednesday Apr 30, 2014 at 14:18 GMT # Sample: Friday Sep 13, 2013 at 22:58 GMT Originally opened as https://github.com/PaulKinlan/WebDocs/issues/152


In the index.html, we have

<!-- build:css {{site.baseurl}}/css/styles.min.css -->
<link rel="stylesheet" media="screen" href="{{site.baseurl}}/css/styles.css" />
 <!-- endbuild -->

For the prod (devsite) grunt task baseurl is /web/fundamentals

This causes useminPrepare to try to copy from /web/fundamentals/css, which doesn't exist, so files don't get minified. I am genuinely not sure how to keep the baseurl set to that url needed but have usemin ignore the /web/fundamentals part for the destination directory

PaulKinlan commented 10 years ago

Comment by andyhawkes Thursday May 01, 2014 at 11:32 GMT # Sample: Friday Sep 13, 2013 at 22:58 GMT


We can add another path variable in to the config if we need something to address that specific issue.

PaulKinlan commented 10 years ago

Comment by ianbarber Thursday May 01, 2014 at 12:06 GMT # Sample: Friday Sep 13, 2013 at 22:58 GMT


That would be handy - I wasn't sure where to go about it to be honest, as it needs /web/fundamentals in the src=" path, but that path never exists on disk

PaulKinlan commented 10 years ago

Comment by andyhawkes Thursday May 01, 2014 at 12:13 GMT # Sample: Friday Sep 13, 2013 at 22:58 GMT


Hmmm... we'll need to figure out the best way of incorporating it into the build workflow.

The unminified CSS is generated by Compass before the site is built by Jekyll, so it might just make more sense to tweak where we run the minification, so that Jekyll will then copy the file over as part of the build.

We could then just reference a single minified CSS file in the HTML for all environments rather than doing the minification as a separate task and/or doing any replacement on the CSS path in the rendered markup.

We originally wanted to keep the unminified CSS accessible so that devs could easily see how the site is built, but as long as the unminified file also sits in the public repo I guess that's still open to them.

I'll have a look at re-working the grunt workflow to see if we can fix this up.

PaulKinlan commented 10 years ago

Comment by ianbarber Thursday May 01, 2014 at 12:54 GMT # Sample: Friday Sep 13, 2013 at 22:58 GMT


Sounds good, thanks!

PaulKinlan commented 10 years ago

@ianbarber was this fixed?

ianbarber commented 10 years ago

This is fixed now AFAIK.