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
[WIP] Support for hackerthemes #3053
Conversation
CHANGES.txt
Outdated
@@ -4,6 +4,7 @@ New in master | |||
Features | |||
-------- | |||
|
|||
* Support hackerthemes.com themes and renamed bootswatch_theme command sub_theme (Issue #3049) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’d prefer to spell it nikola subtheme
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
nikola/plugins/command/sub_theme.py
Outdated
if fname == 'bootstrap.css': | ||
url = 'https://raw.githubusercontent.com/HackerThemes/theme-machine/master/dist/{swatch}/css/bootstrap4-{swatch}.css'.format(swatch=swatch) | ||
else: | ||
url = 'https://raw.githubusercontent.com/HackerThemes/theme-machine/master/dist/{swatch}/css/bootstrap4-{swatch}.min.css'.format(swatch=swatch) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are also some extras required, eg. for executive-suite
one needs to add Google fonts to <head>
:
<link href="https://fonts.googleapis.com/css?family=Merriweather|Oswald|Source+Sans+Pro" rel="stylesheet">
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could tweak that in the subtheme, I guess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a warning.
nikola/plugins/command/subtheme.py
Outdated
LOGGER.info("Downloading: " + url) | ||
r = requests.get(url) | ||
if r.status_code > 299: | ||
LOGGER.error('Error {} getting {}', r.status_code, url) | ||
exit(1) | ||
return 1 | ||
data = r.text | ||
with open(os.path.join('themes', name, 'assets', 'css', fname), | ||
'wb+') as output: | ||
output.write(data.encode('utf-8')) | ||
|
||
with open(os.path.join('themes', name, 'parent'), 'wb+') as output: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, we should probably output a new-style .theme
file instead of parent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. I'll do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
'%s.theme' % parent, themes) | ||
cp = configparser.ConfigParser() | ||
cp.read(parent_theme_data_path) | ||
cp['Theme']['parent'] = parent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing engine. family is unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I take that back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Pull Request Checklist
Description