Skip to content

Commit

Permalink
feat: add copy watch
Browse files Browse the repository at this point in the history
  • Loading branch information
zuofenghua committed Nov 20, 2020
1 parent 3b13e41 commit c6a615d
Show file tree
Hide file tree
Showing 11 changed files with 209 additions and 168 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Then you can use it like `vitepress`
yarn global add vitepress-dg
```

###

## License

Expand Down
3 changes: 3 additions & 0 deletions src/client/theme-default/styles/code.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ code {
padding: 0.25rem 0.5rem;
border-radius: 3px;
margin: 0;
padding: 2px 5px;
color: #d56161;
background: #f6f7f9;
}

code .token.deleted {
Expand Down
28 changes: 14 additions & 14 deletions src/client/theme-default/styles/custom-blocks.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,44 @@
.custom-block.tip,
.custom-block.warning,
.custom-block.danger {
padding: 0.1rem 1.5rem;
border-left-width: 0.5rem;
padding: 10px 20px;
border-left-width: 3px;
border-left-style: solid;
margin: 1rem 0;
margin: 12px 0 24px 0;
box-shadow: 0 6px 16px -2px rgba(0, 0, 0, 0.06);
background-color: #fff;
font-size: 14px;
}

.custom-block p {
line-height: 1;
margin: 0;
}

.custom-block.tip {
background-color: #f3f5f7;
border-color: #42b983;
}

.custom-block.warning {
background-color: rgba(255, 229, 100, 0.3);
border-color: #e7c000;
color: #6b5900;
border-color: #ffc121;
}

.custom-block.warning .custom-block-title {
color: #b29400;
}

.custom-block.warning a {
color: var(--text-color);
.custom-block a {
color: var(--accent-color);
}

.custom-block.danger {
background-color: #ffe6e6;
border-color: #c00;
color: #4d0000;
}

.custom-block.danger .custom-block-title {
color: #900;
}

.custom-block.danger a {
color: var(--text-color);
}

.custom-block.details {
display: block;
Expand Down
5 changes: 3 additions & 2 deletions src/client/theme-default/styles/vars.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
.theme {
--border-color: #ebedf1;
--header-height: 3.6rem;
--sidebar-width: 20rem;
--sidebar-width: 16rem;
--slug-width: 10rem;
--text-color: #454d64;
--text-color-light: #476582;
--code-bg-color: #f9fafb;
--accent-color: #3eaf7c;
/* --accent-color: #3eaf7c; */
--accent-color: #4569d4;
--placeholder-color: #c0c4cc;

/* responsive breakpoints */
Expand Down
22 changes: 13 additions & 9 deletions src/node/build/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,19 @@ export async function build(buildOptions: BuildOptions = {}) {
const hashMapStirng = JSON.stringify(JSON.stringify(pageToHashMap))

for (const page of siteConfig.pages) {
await renderPage(
siteConfig,
page,
clientResult,
appChunk,
cssChunk,
pageToHashMap,
hashMapStirng
)
try {
await renderPage(
siteConfig,
page,
clientResult,
appChunk,
cssChunk,
pageToHashMap,
hashMapStirng
)
} catch {
//
}
}
} finally {
await fs.remove(siteConfig.tempDir)
Expand Down
136 changes: 0 additions & 136 deletions src/node/genTemporary.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/node/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './server'
export * from './build/build'
export * from './config'
export * from './genTemporary'
export * from './temporary/genTemp'
6 changes: 2 additions & 4 deletions src/node/markdown/plugins/containers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ function createContainer(klass: string, defaultTitle: string): ContainerArgs {
{
render(tokens, idx) {
const token = tokens[idx]
const info = token.info.trim().slice(klass.length).trim()
// const info = token.info.trim().slice(klass.length).trim()
if (token.nesting === 1) {
return `<div class="${klass} custom-block"><p class="custom-block-title">${
info || defaultTitle
}</p>\n`
return `<div class="${klass} custom-block">`
} else {
return `</div>\n`
}
Expand Down
2 changes: 1 addition & 1 deletion src/node/resolver.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path'
import { Resolver } from 'vite'
import { UserConfig } from './config'
import { DefaultSrcIncludes } from './genTemporary'
import { DefaultSrcIncludes } from './temporary/genTemp'
import { clearSuffix } from './utils/parseHeader'

export const APP_PATH = path.join(__dirname, '../client/app')
Expand Down
Loading

0 comments on commit c6a615d

Please sign in to comment.