docs: update demo site to build from local
Before Width: | Height: | Size: 808 KiB After Width: | Height: | Size: 808 KiB |
Before Width: | Height: | Size: 310 KiB After Width: | Height: | Size: 310 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
1
packages/demo/dist/index.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
CMS.init(),CMS.registerPreviewStyle(".toastui-editor-contents h1 { color: blue }",{raw:!0}),CMS.registerPreviewTemplate("posts",(({entry:t,widgetFor:e,widgetsFor:i})=>h("div",{},h("div",{className:"cover"},h("h1",{},t.data.title),e("image")),h("p",{},h("small",{},"Written "+t.data.date)),h("div",{className:"text"},e("body"))))),CMS.registerPreviewTemplate("general",(({widgetsFor:t,getAsset:e,entry:i})=>{const s=i.data.site_title,a=i.data.posts,o=a&&a.thumb,[r,d]=useState("");return useEffect((()=>{let t=!0;return(async()=>{const i=await e(o);t&&d(i.toString())})(),()=>{t=!1}}),[o]),h("div",{},h("h1",{},s),h("dl",{},h("dt",{},"Posts on Frontpage"),h("dd",{},t("posts").widgets.front_limit??0),h("dt",{},"Default Author"),h("dd",{},t("posts").data?.author??"None"),h("dt",{},"Default Thumbnail"),h("dd",{},o&&h("img",{src:r}))))})),CMS.registerPreviewTemplate("authors",(({widgetsFor:t})=>h("div",{},h("h1",{},"Authors"),t("authors").map((function(t,e){return h("div",{key:e},h("hr",{}),h("strong",{},t.data.name),t.widgets.description)}))))),CMS.registerWidget("relationKitchenSinkPost","relation",(({fieldsMetaData:t})=>{const e=t&&t.posts.value;return e?h("div",{style:{border:"2px solid #ccc",borderRadius:"8px",padding:"20px"}},h("h2",{},"Related Post"),h("h3",{},e.title),h("img",{src:e.image}),h("p",{},(e.body??"").slice(0,100)+"...")):null})),CMS.registerAdditionalLink({id:"docs",title:"Static CMS Docs",data:"https://staticjscms.netlify.app/",options:{icon:"page"}}),CMS.registerAdditionalLink({id:"config",title:"Demo config.yml",data:"https://github.com/StaticJsCMS/static-cms/blob/main/packages/demo/config.yml",options:{icon:"page"}}),CMS.registerAdditionalLink({id:"custom-page",title:"Custom Page",data:()=>h("div",{},"I am a custom page!"),options:{icon:"page"}}),CMS.registerShortcode("youtube",{label:"YouTube",openTag:"[",closeTag:"]",separator:"|",toProps:t=>t.length>0?{src:t[0]}:{src:""},toArgs:({src:t})=>[t],control:({src:t,onChange:e})=>h("span",{},[h("input",{key:"control-input",value:t,onChange:t=>{e({src:t.target.value})}}),h("iframe",{key:"control-preview",width:"420",height:"315",src:`https://www.youtube.com/embed/${t}`},"")]),preview:({src:t})=>h("span",{},h("iframe",{width:"420",height:"315",src:`https://www.youtube.com/embed/${t}`},""))});
|
@ -1,21 +0,0 @@
|
||||
html,
|
||||
body {
|
||||
color: #444;
|
||||
font-size: 14px;
|
||||
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-top: 20px;
|
||||
color: #666;
|
||||
font-weight: bold;
|
||||
font-size: 32px;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
15
packages/demo/node_modules/.bin/webpack
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../../../../node_modules/webpack/bin/webpack.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../../../../node_modules/webpack/bin/webpack.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
7
packages/demo/node_modules/.bin/webpack.cmd
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
@IF EXIST "%~dp0\node.exe" (
|
||||
"%~dp0\node.exe" "%~dp0\..\..\..\..\node_modules\webpack\bin\webpack.js" %*
|
||||
) ELSE (
|
||||
@SETLOCAL
|
||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
node "%~dp0\..\..\..\..\node_modules\webpack\bin\webpack.js" %*
|
||||
)
|
@ -1,5 +1,16 @@
|
||||
{
|
||||
"name": "@staticcms/demo",
|
||||
"version": "1.0.0",
|
||||
"private": true
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "webpack",
|
||||
"dev": "webpack serve"
|
||||
},
|
||||
"dependencies": {
|
||||
"@staticcms/app": "^1.0.0-beta.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"copy-webpack-plugin": "11.0.0",
|
||||
"webpack": "5.75.0"
|
||||
}
|
||||
}
|
||||
|
BIN
packages/demo/public/assets/uploads/Photo 1-lobby_FS.jpg
Normal file
After Width: | Height: | Size: 808 KiB |
BIN
packages/demo/public/assets/uploads/moby-dick.jpg
Normal file
After Width: | Height: | Size: 310 KiB |
BIN
packages/demo/public/assets/uploads/nf-logo.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
1190
packages/demo/public/config.yml
Normal file
251
packages/demo/public/index.html
Normal file
Before Width: | Height: | Size: 453 KiB After Width: | Height: | Size: 453 KiB |
28
packages/demo/webpack.config.js
Normal file
@ -0,0 +1,28 @@
|
||||
const path = require("path");
|
||||
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
||||
|
||||
const devServerPort = parseInt(process.env.STATIC_CMS_DEMO_DEV_SERVER_PORT || `${3300}`);
|
||||
|
||||
const isProduction = process.env.NODE_ENV === "production";
|
||||
|
||||
module.exports = {
|
||||
entry: "./src/index.js",
|
||||
mode: isProduction ? "production" : "development",
|
||||
plugins: [
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [{ from: "public" }],
|
||||
}),
|
||||
],
|
||||
output: {
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
filename: "index.js",
|
||||
},
|
||||
devServer: {
|
||||
static: {
|
||||
directory: "./dev-test",
|
||||
},
|
||||
host: "0.0.0.0",
|
||||
port: devServerPort,
|
||||
hot: true,
|
||||
},
|
||||
};
|