Skip to content
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

[Develop Theme] How to theme debugging on development #61

Open
drizzlesconsin opened this issue Nov 11, 2020 · 8 comments
Open

[Develop Theme] How to theme debugging on development #61

drizzlesconsin opened this issue Nov 11, 2020 · 8 comments
Assignees
Labels

Comments

@drizzlesconsin
Copy link
Contributor

Is your feature request related to a problem? Please describe.

error: Uncaught (in promise) TypeError: Import 'https://deno.land/x/[email protected]/src/pagic_theme_custom/mod.ts' failed: 404 Not Found

Describe the solution you'd like
请问可以支持这样引用主题吗?
https://github.com/xcatliu/pagic/blob/8df4be35ea/src/Pagic.ts#L30

theme: "../pagic_theme_custom",

Describe alternatives you've considered
还是目前只能基于 Pagic 源码进行开发调试。

Additional context

/** Import theme or themeFile */
export async function importTheme(theme: string, themeFile?: string) {
if (/^https?:\/\//.test(theme)) {
return await importDefault<PagicThemeConfig>(themeFile ? theme.replace(/\/[^\/]+$/, `/${themeFile}`) : theme);
} else {
return await importPagicModDefault<PagicThemeConfig>(`src/themes/${theme}/${themeFile ?? 'mod.ts'}`);
}
}

@xcatliu
Copy link
Owner

xcatliu commented Nov 11, 2020

error: Uncaught (in promise) TypeError: Import 'https://deno.land/x/[email protected]/src/pagic_theme_custom/mod.ts' failed: 404 Not Found

这只是一个示例链接,当前还不存在这个 custom theme,所以是 404。

theme: "../pagic_theme_custom",

目前不支持这样的格式。

你可以先使用 default 主题,然后在本地创建 _layout.tsx 来调试和开发页面,等开发完成后创建一个主题目录,只保留 _layout.tsx 以及一些样式文件,然后发布到 github(或其他地方)上,就可以通过 url 来加载主题了。

@xcatliu
Copy link
Owner

xcatliu commented Nov 11, 2020

可以看看这个 https://pagic.org/zh-CN/docs/themes.html

@drizzlesconsin
Copy link
Contributor Author

可以看看这个 https://pagic.org/zh-CN/docs/themes.html

本地开发似乎比较慢,修改 CSS JS 不能实时更新,比较麻烦,需要重新启动服务。

@xcatliu
Copy link
Owner

xcatliu commented Nov 12, 2020

嗯,这里确实有问题。后续我优化一下开发体验。

我的意思是你可以先写网站内容,然后在网站里写 _layout.tsx 和样式文件,最后调试好了再去掉内容做成主题。像这样:

/site
  hello.md
  _layout.tsx
  assets/index.css

此时运行 pagic runhello.md 会以 _layout.tsx 为模版,也支持保存后自动刷新。等 _layout.tsx 开发完成了,再删掉 hello.md,添加一个 mod.ts 就是一个主题了。

@drizzlesconsin
Copy link
Contributor Author

明白你意思了 👍

@trilom
Copy link

trilom commented Feb 25, 2021

I have a PR incoming for this soon that I am excited about.

Thank you for this project, I really like how simple and clean it is to deploy static sites as I resist Go as much as possible.

My changes include a "watcher" to watch changed files a little better, and some fixes/changes around sourcing themes and utilities to help local development of themes.

@trilom
Copy link

trilom commented Feb 27, 2021

Scope creep is real...

@trilom
Copy link

trilom commented Mar 17, 2021

Hello,

I wanted to share some of my work on this, it is not capable of being pulled but you can at least see the direction of a handful of things. Most of my time has not explicitly been spent on the watcher but more on a logger which was pretty fun.

Another thing to take a look at would be the usage of the PagicConfiguration object and how it is utilized (incompletely) to encapsulate most of the configuration setting/getting and allow the Pagic object to not be as bloated and remain focused by extending the PagicConfiguration class.

I am in a big cleanup phase and will be putting PR's to this work but wanted to get some eyes on it for collaboration or other direction you might have.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants