Skip to content

Commit

Permalink
Fixed development environment and overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
squidfunk committed Nov 11, 2022
1 parent c62ff2c commit 6a1b86e
Show file tree
Hide file tree
Showing 41 changed files with 41 additions and 63 deletions.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ template: home.html
title: Material for MkDocs
---

Welcome to Material for MkDocs.
Welcome to Material for MkDocs.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-#}
{% extends "base.html" %}
{% block extrahead %}
<link rel="stylesheet" href="{{ 'overrides/assets/stylesheets/main.7073df5a.min.css' | url }}">
<link rel="stylesheet" href="{{ 'assets/stylesheets/custom.7073df5a.min.css' | url }}">
{% endblock %}
{% block announce %}
<a href="https://twitter.com/squidfunk">
Expand All @@ -16,5 +16,5 @@
{% endblock %}
{% block scripts %}
{{ super() }}
<script src="{{ 'overrides/assets/javascripts/bundle.d665d539.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/custom.525be7f2.min.js' | url }}"></script>
{% endblock %}
File renamed without changes.

This file was deleted.

6 changes: 3 additions & 3 deletions material/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
{% if not config.theme.palette is mapping %}
<form class="md-header__option" data-md-component="palette">
{% for option in config.theme.palette %}
{% set scheme = option.scheme | d("default", true) %}
{% set primary = option.primary | d("indigo", true) %}
{% set accent = option.accent | d("indigo", true) %}
{% set scheme = option.scheme | d("default", true) %}
{% set primary = option.primary %}
{% set accent = option.accent %}
<input class="md-option" data-md-color-media="{{ option.media }}" data-md-color-scheme="{{ scheme | replace(' ', '-') }}" data-md-color-primary="{{ primary | replace(' ', '-') }}" data-md-color-accent="{{ accent | replace(' ', '-') }}" {% if option.toggle %} aria-label="{{ option.toggle.name }}" {% else %} aria-hidden="true" {% endif %} type="radio" name="__palette" id="__palette_{{ loop.index }}">
{% if option.toggle %}
<label class="md-header__button md-icon" title="{{ option.toggle.name }}" for="__palette_{{ loop.index0 or loop.length }}" hidden>
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ copyright: Copyright &copy; 2016 - 2022 Martin Donath
# Configuration
theme:
name: material
custom_dir: material/overrides
custom_dir: material/.overrides
features:
# - announce.dismiss
- content.code.annotate
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ include = ["/material"]

[tool.hatch.build.targets.sdist]
include = ["/material", "/package.json", "/requirements.txt"]
exclude = ["/material/overrides"]
exclude = ["/material/.overrides"]
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function mountIconSearch(
): Observable<Component<IconSearch>> {
const config = configuration()
const index$ = requestJSON<IconSearchIndex>(
new URL("overrides/assets/javascripts/iconsearch_index.json", config.base)
new URL("assets/javascripts/iconsearch_index.json", config.base)
)

/* Retrieve query and result components */
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@

@import "config";

@import "main/typeset";
@import "custom/typeset";

@import "main/layout/banner";
@import "main/layout/hero";
@import "main/layout/iconsearch";
@import "main/layout/sponsorship";

@import "main/shame";
@import "custom/layout/banner";
@import "custom/layout/hero";
@import "custom/layout/iconsearch";
@import "custom/layout/sponsorship";
File renamed without changes.
4 changes: 2 additions & 2 deletions src/overrides/main.html → src/.overrides/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<!-- Extra style sheets (can't be set in mkdocs.yml due to content hash) -->
<link
rel="stylesheet"
href="{{ 'overrides/assets/stylesheets/main.css' | url }}"
href="{{ 'assets/stylesheets/custom.css' | url }}"
/>
{% endblock %}

Expand All @@ -48,5 +48,5 @@
{{ super() }}

<!-- Extra JavaScript (can't be set in mkdocs.yml due to content hash) -->
<script src="{{ 'overrides/assets/javascripts/bundle.js' | url }}"></script>
<script src="{{ 'assets/javascripts/custom.js' | url }}"></script>
{% endblock %}
File renamed without changes.
6 changes: 3 additions & 3 deletions src/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@
{% if not palette is mapping %}
{% set palette = palette | first %}
{% endif %}
{% set scheme = palette.scheme | d("default", true) %}
{% set primary = palette.primary | d("indigo", true) %}
{% set accent = palette.accent | d("indigo", true) %}
{% set scheme = palette.scheme | d("default", true) %}
{% set primary = palette.primary %}
{% set accent = palette.accent %}
<body
dir="{{ direction }}"
data-md-color-scheme="{{ scheme | replace(' ', '-') }}"
Expand Down
25 changes: 0 additions & 25 deletions src/overrides/assets/stylesheets/main/_shame.scss

This file was deleted.

6 changes: 3 additions & 3 deletions src/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@
{% if not config.theme.palette is mapping %}
<form class="md-header__option" data-md-component="palette">
{% for option in config.theme.palette %}
{% set scheme = option.scheme | d("default", true) %}
{% set primary = option.primary | d("indigo", true) %}
{% set accent = option.accent | d("indigo", true) %}
{% set scheme = option.scheme | d("default", true) %}
{% set primary = option.primary %}
{% set accent = option.accent %}
<input
class="md-option"
data-md-color-media="{{ option.media }}"
Expand Down
3 changes: 2 additions & 1 deletion tools/build/_/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import glob from "tiny-glob"
interface ResolveOptions {
cwd: string /* Working directory */
watch?: boolean /* Watch mode */
dot?: boolean /* Hidden files or directories */
}

/**
Expand Down Expand Up @@ -106,7 +107,7 @@ function now() {
export function resolve(
pattern: string, options?: ResolveOptions
): Observable<string> {
return from(glob(pattern, options))
return from(glob(pattern, { ...options, dot: true }))
.pipe(
catchError(() => EMPTY),
concatAll(),
Expand Down
14 changes: 9 additions & 5 deletions tools/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const sources$ = copyAll("**/*.py", {
const stylesheets$ = resolve("**/[!_]*.scss", { cwd: "src" })
.pipe(
mergeMap(file => zip(
of(ext(file, ".css")),
of(ext(file, ".css").replace(".overrides/", "")),
transformStyle({
from: `src/${file}`,
to: ext(`${base}/${file}`, ".css")
Expand All @@ -178,10 +178,10 @@ const stylesheets$ = resolve("**/[!_]*.scss", { cwd: "src" })
)

/* Transform scripts */
const javascripts$ = resolve("**/{bundle,search}.ts", { cwd: "src" })
const javascripts$ = resolve("**/{custom,bundle,search}.ts", { cwd: "src" })
.pipe(
mergeMap(file => zip(
of(ext(file, ".js")),
of(ext(file, ".js").replace(".overrides/", "")),
transformScript({
from: `src/${file}`,
to: ext(`${base}/${file}`, ".js")
Expand Down Expand Up @@ -209,7 +209,10 @@ const manifest$ = merge(
.pipe(
scan((prev, mapping) => (
mapping.reduce((next, [key, value]) => (
next.set(key, value.replace(`${base}/`, ""))
next.set(key, value.replace(
new RegExp(`${base}\\/(\.overrides\\/)?`),
""
))
), prev)
), new Map<string, string>()),
)
Expand All @@ -222,6 +225,7 @@ const templates$ = manifest$
to: base,
watch: process.argv.includes("--watch"),
transform: async data => {
console.log(manifest)
const metadata = require("../../package.json")
const banner =
"{#-\n" +
Expand Down Expand Up @@ -300,7 +304,7 @@ const index$ = zip(icons$, emojis$)
} as IconSearchIndex
}),
switchMap(data => write(
`${base}/overrides/assets/javascripts/iconsearch_index.json`,
`${base}/.overrides/assets/javascripts/iconsearch_index.json`,
JSON.stringify(data)
))
)
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"noUnusedParameters": true,
"paths": {
"~/*": ["./assets/javascripts/*"],
"_/*": ["./overrides/assets/javascripts/*"]
"_/*": ["./.overrides/assets/javascripts/*"]
},
"removeComments": false,
"sourceMap": true,
Expand All @@ -34,7 +34,7 @@
},
"include": [
"src/assets/javascripts",
"src/overrides/assets/javascripts",
"src/.overrides/assets/javascripts",
"tools",
"typings"
]
Expand Down

0 comments on commit 6a1b86e

Please sign in to comment.