Module

x/pagic/src/utils/mod.ts

A static site generator powered by Deno + React
Latest
import * as mod from "https://dotland.deno.dev/x/pagic@v1.6.3/src/utils/mod.ts";

Variables

Get the runtime pagic root path, it should be a file-system-path or a url /User/xcatliu/work/github/pagic or https://deno.land/x/pagic

Functions

Compile input code from tsx to js, by typescript compiler Will replace .tsx to .js in import statement, and remove react and react-dom imports

Read input file and then compile it

Compile a pagic file with local or remote url

Traversal a tree or tree[]

input: ('foo/bar/baz.md', ['foo/_layout.tsx', '_layout.tsx']) output: 'foo/_layout.tsx'

Get and parse messages from git log

input: foo/README.md output: foo/index.html

Replacement of dynamic import, enable cache by default, support reload options

Replacement of dynamic import default

Import pagic mod

Import pagic mod default

Import plugin

Import theme or themeFile

Omit the specific items of an object

input: FooBar output: _foo_bar

Pick the specific items of an object

input: foo/bar.html replacement: _content.js output: foo/bar_content.js

input: foo/bar.md output: foo/bar.html

input: [{name:'a'}, {name:'b'}, {name:'c',insert:'before:b'}] output: [{name:'a'}, {name:'c',insert:'before:b'}, {name:'b'}]

截取指定长度的中英文混合字符串

input: _foo_bar output: FooBar

Remove same items in an array

A util to replace fs.walk method, return relativeToSrcPath instead of fullPath