Skip to content

Conversation

@schacon
Copy link
Member

@schacon schacon commented Oct 14, 2014

We were linking to http://jashkenas.github.io/docco/resources/linear/docco.css but that has changed a lot and the examples all look horrible now. This should fix it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hardcoding seems unnecessary, since we control what gets written out and have the file at ex/css.css, simply href="css.css" should be enough, no?

I hear rumours that people other than libgit2 use this project, so they'd probably appreciate it if we didn't hardcode our url into it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, yeah, I'm sure there's a good way to do this, I'm just a little rusty on how this library works exactly. The main issue is that there are example files in both ex/file and ex/network/file so relative links don't work without more magic. I have to make them absolute. but that means that I have to hardcode the libgit2 in there I believe (like /libgit2/ex/css.css). So stupid.

It may actually be easier to just slap the css itself into this template file rather than linking it. Not super efficient, but it's simpler and bulletproof.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The api.docurium file has a github field which we could use to determine whether the project is hosted on GitHub, so we could base some logic off of that, but I agree it's al going to be somewhat ugly no matter what.

If we include {{css}} somwhere and pass in the contents of the CSS file, it should work, even if it means larger file sizes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what I'm going to do here is calculate the relative path of the example to the css file. We know where the css file is and we know the path to the file, so we can count the slashes and put the right amount of '../' in a string to pass to mustache.

Instead of hard-coding libgit2's location, detect how deep the example
is and use a relative path, allowing for use in different projects.
carlosmn added a commit that referenced this pull request Dec 19, 2014
Vendor the css and refer to it instead
@carlosmn carlosmn merged commit a7cb8a3 into master Dec 19, 2014
@carlosmn
Copy link
Member

I've added the logic which knows how to create a relative path from the example to the CSS file, so we can use this wherever.

@carlosmn carlosmn deleted the vendor-css branch December 19, 2014 12:33
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

Successfully merging this pull request may close these issues.

3 participants