Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Css and Js files link to wrong directory for project Github Pages #134

Open
agarrharr opened this issue Feb 3, 2015 · 23 comments
Open

Css and Js files link to wrong directory for project Github Pages #134

agarrharr opened this issue Feb 3, 2015 · 23 comments

Comments

@agarrharr
Copy link

My github page's css is being generated at http://mountainview-webdesign.github.io/lifestonechurch/main.f4ca.css, but in the index.html it points to http://mountainview-webdesign.github.io/css/main.f4ca.css

I can't figure out how to get it to work. I would think that this should work out of the box. What am I doing wrong?

@dnozay
Copy link
Collaborator

dnozay commented Feb 4, 2015

Did you check your Gruntfile.js for problems with paths?

@agarrharr
Copy link
Author

No, I didn't know that was necessary. What part of the Gruntfile.js should I change to make this work?

@dnozay
Copy link
Collaborator

dnozay commented Feb 6, 2015

I don't know, can't really help without your code.

@agarrharr
Copy link
Author

Here it is. https://github.com/Mountainview-WebDesign/lifestonechurch
Also, you can check out the site itself and see that it can't load the css. http://mountainview-webdesign.github.io/lifestonechurch/

I think the only thing I've changed in the Gruntfile is the buildcontrol.dist.options.remote. Also, I tried commenting out the usemin stuff, but I went back.

@dnozay
Copy link
Collaborator

dnozay commented Feb 6, 2015

http://jekyllrb.com/docs/configuration/

you need baseurl: /name-of-github-project, in other words baseurl: /lifestonechurch

@agarrharr
Copy link
Author

Should that go in _config.build.yml or _config.yml?

@agarrharr
Copy link
Author

That still isn't working for me, but it looks like I've also got another problem on my hands. It's not generating the css files at all in my gh-pages branch.

@dnozay
Copy link
Collaborator

dnozay commented Feb 6, 2015

This generator won't help you much if you are not already familiar with jekyll, there is a ton of documentation for github pages out there.

@agarrharr
Copy link
Author

I am familiar with jekyll. I've created sites with it before, which is why I wanted to streamline my workflow with this generator.

But I'm not sure what's happening in this Gruntfile, what belongs in _config.build.yml as opposed to _config.yml, and what in the Gruntfile.js that I should change. It seems to me that I should keep my hands off of the Gruntfile.js so that I can update my code when there is an update to the generator.

I would have expected this generator to work out of the box with github pages on a project (repo), and if not, I would expect some specific instruction on the readme to help me set it up.

Does that make sense?

@dnozay
Copy link
Collaborator

dnozay commented Feb 6, 2015

I think the baseurl setting goes in _config.yml and that you could use jekyll serve to test it out locally.

@agarrharr
Copy link
Author

I think it actually goes in _config.build.yml because it breaks it for me locally if I change it in _config.yml.

I think it could be an issue with grunt-usemin. Because even if I say:

<link rel="stylesheet" href="{{site.baseurl}}/css/syntax.css">

It always changes the path to:

<link rel="stylesheet" href="/css/main.f4ca.css">

http://stackoverflow.com/questions/18964875/how-should-i-configure-grunt-usemin-to-work-with-relative-path
yeoman/grunt-usemin#447
yeoman/grunt-usemin#184
yeoman/grunt-usemin#368

But my question would be, has anyone ever gotten this generator to work with github pages projects?

@mashcode
Copy link

Yes, I got it to work by shimming the url...but now in a new project grunt-cdn explicitly requires cwd and dest paths.

I have been working on this https://gist.github.com/mashcode/27643189f1f42dcbb176 but have hit a wall when it stalls at the cdn task. Maybe the paths are wrong? Requires [email protected] node_modules/grunt-cdn

Marc

@mashcode
Copy link

Hi, A work around I just implemented is to use a CNAME alias. So instead of [ user.github.io/whatever ] it can redirect to [ whatever.myTLD.foo ]

This will obviously require the ability to manage your own dns records.

@agarrharr
Copy link
Author

That's true, a custom domain would solve the problem. What do you mean you got it it work by "shimming" the url?

@mashcode
Copy link

On Feb 19, 2015, at 1:47 PM, Adam Harris [email protected] wrote:

That's true, a custom domain would solve the problem. What do you mean you got it it work by "shimming" the url?

Hey Adam, Best to look at the gist I posted. It essentially prepends the project path to media, eg css/js files in the grunt build execution at min. Typically used for CDN URL hacking, hence the name. In theory it should work with any path.

Does CNAME point all requests, even GitHub.io, to the alias? Or does one have to write a rule?

Marc


Reply to this email directly or view it on GitHub.

@agarrharr
Copy link
Author

Ok, so this is the part you added: https://gist.github.com/mashcode/27643189f1f42dcbb176#file-gruntfile-js-L198-L208

Perhaps, this jekyll generator should consider using grunt-cdn?

@mashcode
Copy link

On Feb 19, 2015, at 2:19 PM, Adam Harris [email protected] wrote:

Ok, so this is the part you added: https://gist.github.com/mashcode/27643189f1f42dcbb176#file-gruntfile-js-L198-L208

Perhaps, this jekyll generator should consider using grunt-cdn?

Sure, if I can figure out why the task hangs.

Well in all fairness the system is really designed for dev => production flow. A vanilla Jekyll can handle the majority of the factions and can serve up static project pages

Marc


Reply to this email directly or view it on GitHub.

@agarrharr
Copy link
Author

What do you mean by a "dev => production flow"

@mashcode
Copy link

On Feb 19, 2015, at 4:06 PM, Adam Harris [email protected] wrote:

What do you mean by a "dev => production flow"

I know, sorry, I realize now a bad choice of words and to be honest not real worthy of definition, suffice it to say the Jekyllrb threadbare workflow to me looks like:

local check/build => dist
remote check/deploy => prod

Hope it makes sense, Marc


Reply to this email directly or view it on GitHub.

@zheli
Copy link

zheli commented Mar 24, 2015

+1 on this issue

@trenkwill
Copy link

+1

1 similar comment
@jrmm33
Copy link

jrmm33 commented Jan 26, 2019

+1

@agarrharr
Copy link
Author

I'm not longer using this project, so I'm going to unsubscribe from notifications, but if other people are still having this issue, I'll leave it open.

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

No branches or pull requests

6 participants