Skip to content

Commit e864ec7

Browse files
Josh SagerGitHub Enterprise
authored andcommitted
Merge pull request linode#5 from abailly/child-theme-implementation
Child theme implementation
2 parents 407d2d4 + e21d71e commit e864ec7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+12070
-433
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ languageCode = "en-us"
33
title = "Linode Developers Site"
44
defaultContentLanguage = "en"
55
paginate = 25
6-
theme = "linode-hugo-base-theme"
6+
theme = ["dlc", "linode-hugo-base-theme"]
77

88
# menu
99
[menu]

themes/dlc/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
yarn-error.log
3+
.DS_Store
4+
/static/assets/cssinfo/

themes/dlc/.stylelintrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "stylelint-config-standard",
3+
"rules": {
4+
"no-missing-end-of-source-newline": null,
5+
}
6+
}

themes/dlc/LICENSE

100644100755
Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
The MIT License (MIT)
1+
MIT License
22

3-
Copyright (c) 2018 YOUR_NAME_HERE
3+
Copyright (c) 2017 Adam Wathan <[email protected]>
44

5-
Permission is hereby granted, free of charge, to any person obtaining a copy of
6-
this software and associated documentation files (the "Software"), to deal in
7-
the Software without restriction, including without limitation the rights to
8-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9-
the Software, and to permit persons to whom the Software is furnished to do so,
10-
subject to the following conditions:
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
1111

1212
The above copyright notice and this permission notice shall be included in all
1313
copies or substantial portions of the Software.
1414

1515
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

themes/dlc/README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Linode Hugo Bade Theme
2+
3+
Base theme for Hugo. Using PostCSS, TailwindCSS and gulp as a task manager.
4+
Lightweight, versatile and aimed to facilitate developmenmt by using utlility classes while remaining lean.
5+
6+
## Setup
7+
8+
Install Dependencies
9+
`yarn`
10+
11+
Compile
12+
`gulp`
13+
14+
Watch during development
15+
`gulp watch`
16+
17+
## Tools
18+
19+
This theme uses <a href="https://tailwindcss.com/docs/what-is-tailwind/" target="_blank">TailwindCSS</a> as a utlility library.
20+
Just add the classes provided by the library to tailor your application.
21+
22+
add
23+
24+
```
25+
[params.dev]
26+
enable = true
27+
```
28+
29+
to your `config.toml` (root dir) to enable the css helper. This will enable a small icon in the bottom right corner of your site. This helper shows you what's available in your css to use for your markup.
30+
It is a combination of the tailwind styles and custom styles from your theme's CSS.
31+
32+
To avoid ending up with a very large bundle of unused css utility classes, the gulp setup uses CSSPurge to strip whatever is not used in the HUGO layouts.
33+
This ensures a small css bundle for production use.
34+
35+
The gulp setup also includes a linter and the nanocss minifier.
36+
37+
## Architecture
38+
39+
In order to customize this theme, the proper way is to move/copy the enclosed CHILD-THEME under the `/themes` dir, rename it to your liking and add your modifications from within.
40+
This will ensure the maintainability of the linode-base-theme for future updates.
41+
42+
*Note*: You will need to make sure the theme inheritance is set up in your config.toml. (See <a href="https://gohugo.io/themes/theme-components/" target="_blank">Theme Components</a>).
43+
44+
for instance:
45+
46+
```
47+
theme = ["my-new-theme(child-theme)", "linode-base-theme"]
48+
```
49+
50+
The theme follows the concept of <a href="http://bradfrost.com/blog/post/atomic-web-design/" target="_blank">Atomic Design</a> to structure its templates and CSS.
51+
It is a rather arbitrary set of rules to keep a consistent design system when dealing with a large amount of templates and help with template inheritance.
52+
53+
You will probably want to keep a similar structure for template overriding: see the <a href="https://gohugo.io/templates/lookup-order/" target="_blank">lookup order</a> for more info.
54+
55+
## Default Content
56+
57+
The theme uses `config.toml` to populate some of its templates, so it will probably be empty upon installation.
58+
59+
ex: `layouts/partials/2_molecules/nav.html`
60+
relies on such definition in `config.toml`
61+
62+
```
63+
[menu]
64+
65+
[[menu.main]]
66+
weight = 1
67+
name = "Page 1"
68+
url = "/"
69+
70+
[[menu.main]]
71+
weight = 2
72+
name = "Page 2"
73+
url = "page2"
74+
75+
[[menu.main]]
76+
weight = 3
77+
name = "Page 3"
78+
url = "page3"
79+
```

themes/dlc/archetypes/default.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
+++
2-
+++
1+
---
2+
title: "{{ replace .Name "-" " " | title }}"
3+
date: {{ .Date }}
4+
draft: true
5+
---
6+

themes/dlc/gulpfile.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
const gulp = require('gulp');
2+
const postcss = require('gulp-postcss');
3+
const plumber = require('gulp-plumber');
4+
const tailwindcss = require('tailwindcss');
5+
const atImport = require('postcss-easy-import');
6+
const purgecss = require('gulp-purgecss')
7+
const autoprefixer = require('autoprefixer');
8+
const cssInfo = require('gulp-css-info');
9+
const cssnano = require('cssnano');
10+
const stylelint = require('stylelint');
11+
const reporter = require('postcss-reporter');
12+
13+
const tailwind = 'tailwind.js';
14+
const mainCss = './srcCSS/main.css';
15+
const css = './srcCSS/**/*.css';
16+
const html = './layouts/**/*.html'
17+
const output = 'static/assets/css/';
18+
const cssInfoDir = 'static/assets/cssinfo/';
19+
20+
const plugins = [
21+
atImport,
22+
tailwindcss('./tailwind.js'),
23+
autoprefixer({
24+
browsers: ['last 2 versions', '> 2%']
25+
}),
26+
cssnano
27+
];
28+
29+
gulp.task('lint', () => {
30+
return gulp.src('./srcCSS/**/*.css')
31+
.pipe(postcss([
32+
stylelint(),
33+
reporter(),
34+
]));
35+
});
36+
37+
gulp.task('cssInfo', () => {
38+
return gulp.src(mainCss)
39+
.pipe(postcss(plugins))
40+
.pipe(cssInfo())
41+
.pipe(gulp.dest(cssInfoDir))
42+
});
43+
44+
gulp.task('compile', () => {
45+
return gulp.src(mainCss)
46+
.pipe(plumber())
47+
.pipe(postcss(plugins))
48+
.pipe(
49+
purgecss({
50+
content: [html],
51+
whitelist: ['mobile-nav', ['active']]
52+
})
53+
)
54+
.pipe(gulp.dest(output));
55+
});
56+
57+
gulp.task('watch:css', () => {
58+
gulp.watch(css, ['compile']);
59+
});
60+
61+
gulp.task('watch:html', () => {
62+
gulp.watch(html, ['compile']);
63+
});
64+
65+
gulp.task('watch:tailwind', () => {
66+
gulp.watch(tailwind, ['compile']);
67+
});
68+
69+
gulp.task('default', ['lint', 'compile', 'cssInfo']);
70+
gulp.task('watch', ['compile', 'watch:css', 'watch:html', 'watch:tailwind']);

themes/dlc/layouts/_default/baseof.html

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{{ define "main" }}
2+
{{ end }}

themes/dlc/layouts/_default/list.html

Lines changed: 0 additions & 22 deletions
This file was deleted.

themes/dlc/layouts/_default/single.html

Lines changed: 0 additions & 27 deletions
This file was deleted.

themes/dlc/layouts/index.html

Lines changed: 0 additions & 24 deletions
This file was deleted.

themes/dlc/layouts/libraries-tools/single.html

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)