question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Usecases for --stylesheet vs. --css handling in the HTML template

See original GitHub issue

Initially, the HTML template received the path for the stylesheet (either the default one, or a custom one provided with the --stylesheet option):

https://github.com/danburzo/percollate/blob/7c43aec36d94476fcaa31d136fcebd053d70f87e/templates/default.html#L3-L7

With the introduction of the --css option, I changed it to:

https://github.com/danburzo/percollate/blob/cecd11e0c290d0bd0b653047c53e2f82bfb31fca/templates/default.html#L7-L9

And deprecated the passing of the stylesheet property to the template.

However, I think I might have missed a valid use-case for an external stylesheet, namely being able to reference outside resources (images, web fonts) in the custom CSS.

This issue outline some use-cases, to make sure the final solution covers all of them elegantly:

  • Override just the page size, margins, font sizes
  • Override the default stylesheet with a custom one
  • Use local web fonts in the custom stylesheet

(Adding to this list as more use-cases arise)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
danburzocommented, Oct 27, 2018

Oops, missed your comment here. Yes, you can set it on the html element. Also, I’ll add in the docs how to use the CSS variables --body-font and --alt-font.

0reactions
danburzocommented, Jul 29, 2020

Override just the page size, margins, font sizes

This works well with the --css option.

Override the default stylesheet with a custom one.

This works via the --style option.

Use local web fonts.

For PDFs and HTMLs you can either reference fonts by name with local(), or use their absolute path on disk. EPUBs currently don’t fetch these fonts to bundle them, but that’s okay.

I think we can close the issue for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Style Sheets in HTML documents - W3C
In many cases, authors will take advantage of a common style sheet for a group of documents. In this case, distributing style rules...
Read more >
Styled Components vs. CSS Stylesheets - GetStream.io
There's a hot debate around standard CSS stylesheets vs. “CSS-in-JS” solutions when building in modern front-end frameworks.
Read more >
Organizing your CSS - Learn web development | MDN
I mentioned above that one way to organize CSS is to break down stylesheets into smaller stylesheets. When using Sass you can take...
Read more >
What are CSS Modules and why do we need them?
CSS files in which all class names and animation names are scoped locally by default. So CSS Modules is not an official spec...
Read more >
External CSS Stylesheets – How to Link CSS to HTML and ...
It is considered a best practice to have your CSS stylesheets in an external file. So how can you link that CSS to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found