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

Bootstrap theming #19

Closed
anapaulagomes opened this issue Oct 16, 2018 · 2 comments
Closed

Bootstrap theming #19

anapaulagomes opened this issue Oct 16, 2018 · 2 comments

Comments

@anapaulagomes
Copy link

Hi, thank you for the great work. :)

I'm a noob on bootstrap stuff. Can you tell me if it is possible to use the bootstrap theming on Hugo? I'd like to change things like the nav-bar and the URLs text colors. Thanks!

@Xzya
Copy link
Owner

Xzya commented Nov 4, 2018

Hello,

Sorry for the delay. Yes, it is possible.

I don't know the full steps, but it should be something along those lines:

  • Include the bootstrap source in your project (e.g. using npm, take a look here for an example https://github.com/alanorth/hugo-theme-bootstrap4-blog/blob/master/package.json#L21)

  • Add your own custom SCSS which includes Bootstrap's SCSS, as described in the link you provied

  • Include your custom SCSS in the template. You can do this by overriding the custom-header.html partial, and include the link to your styles there. However, you cannot directly include SCSS in HTML, it needs to be processed to CSS. To do this, you have several options:

    • Hugo added support for this in a more recent version, take a look here
{{ $styles := resources.Get "scss/custom.scss" | toCSS | postCSS | minify | fingerprint }}
<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" media="screen">
  • You can also use a separate tool to generate the CSS and then include the link to the generated file, you can see an example here. But I would recommend using the first method.

Some other resources:

Let me know if this answers your question,
Thank you!

@anapaulagomes
Copy link
Author

That's cool. Thank you for the detailed explanation! @Xzya

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

2 participants