Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeh committed May 7, 2019
1 parent 7c4975f commit 1d5d6f9
Show file tree
Hide file tree
Showing 12 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/concepts/index.html

Large diffs are not rendered by default.

Binary file modified docs/concepts/index.html.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/files/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/core/favicon.ico"/><title>@magic/core files</title><meta name="description" content="@magic/core directory docs."/><link rel="stylesheet" href="/core/magic.css"/></head><body><div id="magic"><div class="wrapper"><header class="main"><a class="logo-wrapper" href="/core/"><img class="logo" src="/core/logo.png" role="presentation" alt=""/><span class="logo-text">@magic</span></a><nav class="Menu"><ul><li class="MenuItem"><a href="/core/concepts/">concepts</a></li><li class="MenuItem"><a href="/core/files/">files &amp; directories</a></li><li class="MenuItem"><a href="/core/modules/">modules</a></li><li class="MenuItem"><a href="/core/themes/">themes</a></li><li class="MenuItem"><a href="/core/libraries/">libraries</a></li></ul></nav></header><div class="page"><h1>@magic/core files</h1><p>There are multiple magic files and directories.</p><ul><li>/pages - files in the page directory map to urls in your app.</li><li>/assets - custom components, @magic-modules get imported here</li><li>/assets/static - static files</li><li>/assets/themes - theme directory, @magic-themes get imported here</li><li>/assets/lib.js - imports npm and local but external packages into your app</li><li>/app.js - gets merged into the app, can set state, actions, style here</li><li>/config.js - custom config for your app</li><li>/assets/Menu.js - custom Menu for your app</li></ul><h2 id="pages">/pages</h2><p>the pages dir contains the pages of your webapp.</p><p>each page has it&#39;s own state and actions, but also inherits the global state and actions from the app and it&#39;s dependencies</p><h3 id="pages-dir-structure">pages directory to url map, for the domain mag.ic:</h3><ul><li>/pages/index.js === http://mag.ic/</li><li>/pages/pageName.js === http://mag.ic/pageName/</li><li>/pages/page-name.js === http://mag.ic/page-name/</li><li>/pages/page_name.js === http://mag.ic/page_name/</li><li>/pages/dir/index.js === http://mag.ic/dir/</li><li>/pages/dir/name.js === http://mag.ic/dir/name/</li></ul><h3 id="pages-example">example page:</h3><h2 id="assets">/assets</h2><p>the assets dir contains custom components of your app.</p><p>you can additionally import @magic-modules here</p><h3 id="assets-example">example /assets/index.js</h3><h2 id="static">/assets/static</h2><p>the static dir contains all of your static assets.</p><p>every file in this directory gets copied to the public dir.</p><p>image and svg files get minified using imagemin</p><p>text and binary files get compressed using the optional <a href="https://github.com/jaeh/node-zopfli-es" target="_blank" rel="noopener">node-zopfli-es</a> (if it is installed)</p><h2 id="themes">/assets/themes</h2><p>the themes directory contains... themes.</p><p>at the moment this is file based, which means you have to manually import themes there.</p><h3 id="themes-example">example theme</h3><h2 id="app">/assets/app.js</h2><p>the /app.js file allows you to set global state, actions, and styles</p><h3 id="app-example">example /app.js</h3><h2 id="config">/config.js</h2><p>the /config.js file allows you to set various aspects of your app</p><h3 id="config-example">example /config.js</h3><h2 id="menu">/assets/Menu.js</h2><p>the /assets/Menu.js file allows you to replace the default Menu component</p><h3 id="menu-example">example /assets/Menu.js</h3><a href="https://github.com/magic/core/blob/master/src/modules/Menu.js" target="_blank" rel="noopener">Menu.js on github</a></div><footer class="main"><div class="wrapper">made with a few bits of <a target="_blank" rel="noopener" href="https://github.com/magic/core">magic</a></div></footer></div></div><script src="/core/magic.js"></script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/core/favicon.ico"/><title>@magic/core files</title><meta name="description" content="@magic/core directory docs."/><link rel="stylesheet" href="/core/magic.css"/></head><body><div id="magic"><div class="wrapper"><header class="main"><a class="logo-wrapper" href="/core/"><img class="logo" src="/core/logo.png" role="presentation" alt=""/><span class="logo-text">@magic</span></a><nav class="Menu"><ul><li class="MenuItem"><a href="/core/concepts/">concepts</a></li><li class="MenuItem"><a href="/core/files/">files &amp; directories</a></li><li class="MenuItem"><a href="/core/modules/">modules</a></li><li class="MenuItem"><a href="/core/themes/">themes</a></li><li class="MenuItem"><a href="/core/libraries/">libraries</a></li></ul></nav></header><div class="page"><h1>@magic/core files</h1><p>There are multiple magic files and directories.</p><ul><li>/pages - files in the page directory map to urls in your app.</li><li>/assets - custom components, @magic-modules get imported here</li><li>/assets/static - static files</li><li>/assets/themes - theme directory, @magic-themes get imported here</li><li>/assets/lib.js - imports npm and local but external packages into your app</li><li>/app.js - gets merged into the app, can set state, actions, style here</li><li>/config.js - custom config for your app</li><li>/assets/Menu.js - custom Menu for your app</li></ul><h2 id="pages">/pages</h2><p>the pages dir contains the pages of your webapp.</p><p>each page has it&#39;s own state and actions, but also inherits the global state and actions from the app and it&#39;s dependencies</p><h3 id="pages-dir-structure">pages directory to url map, for the domain mag.ic:</h3><ul><li>/pages/index.js === http://mag.ic/</li><li>/pages/pageName.js === http://mag.ic/pageName/</li><li>/pages/page-name.js === http://mag.ic/page-name/</li><li>/pages/page_name.js === http://mag.ic/page_name/</li><li>/pages/dir/index.js === http://mag.ic/dir/</li><li>/pages/dir/name.js === http://mag.ic/dir/name/</li></ul><h3 id="pages-example">example page:</h3><div class="Pre light"><div class="menu"><button>dark</button><button>copy</button></div><pre><code class="line"><span class="keyword">module</span>.<span class="keyword">exports</span> = {</code><code class="line"> <span class="state">state</span>: {</code><code class="line"> <span class="colon">variable</span>: <span class="string">&#39;test&#39;</span>,</code><code class="line"> },</code><code class="line"> <span class="actions">actions</span>: {</code><code class="line"> <span class="colon">changeVar</span>: () =&gt; ({ <span class="colon">variable</span>: <span class="string">&#39;changed&#39;</span> }),</code><code class="line"> },</code><code class="line"> <span class="colon">style</span>: {</code><code class="line"> <span class="string">&#39;.<span class="property">cl</span>&#39;</span>: {</code><code class="line"> <span class="colon">color</span>: <span class="string">&#39;green&#39;</span>,</code><code class="line"> },</code><code class="line"> },</code><code class="line"> <span class="colon">View</span>: <span class="state">state</span> =&gt; div({ <span class="colon">class</span>: <span class="string">&#39;cl&#39;</span> }, [</code><code class="line"> <span class="string">&#39;<span class="keyword">this</span> is the page <span class="object">content</span>.&#39;</span>,</code><code class="line"> <span class="state">state</span>.<span class="property">variable</span>,</code><code class="line"> ]),</code><code class="line">}</code></pre></div><h2 id="assets">/assets</h2><p>the assets dir contains custom components of your app.</p><p>you can additionally import @magic-modules here</p><h3 id="assets-example">example /assets/index.js</h3><div class="Pre light"><div class="menu"><button>dark</button><button>copy</button></div><pre><code class="line"><span class="keyword">module</span>.<span class="keyword">exports</span> = {</code><code class="line"> <span class="colon">Custom</span>: () =&gt; div(<span class="string">&#39;custom component&#39;</span>),</code><code class="line"> <span class="colon">Pre</span>: <span class="keyword">require</span>(<span class="string">&#39;@magic-modules/pre),&#39;</span></code><code class="line">}</code></pre></div><h2 id="static">/assets/static</h2><p>the static dir contains all of your static assets.</p><p>every file in this directory gets copied to the public dir.</p><p>image and svg files get minified using imagemin</p><p>text and binary files get compressed using the optional <a href="https://github.com/jaeh/node-zopfli-es" target="_blank" rel="noopener">node-zopfli-es</a> (if it is installed)</p><h2 id="themes">/assets/themes</h2><p>the themes directory contains... themes.</p><p>at the moment this is file based, which means you have to manually import themes there.</p><h3 id="themes-example">example theme</h3><div class="Pre light"><div class="menu"><button>dark</button><button>copy</button></div><pre><code class="line"><span class="keyword">module</span>.<span class="keyword">exports</span> = {</code><code class="line"> <span class="string">&#39;body&#39;</span>: {</code><code class="line"> <span class="colon">color</span>: <span class="string">&#39;blue&#39;</span>,</code><code class="line"> },</code><code class="line">}</code></pre></div><h2 id="app">/assets/app.js</h2><p>the /app.js file allows you to set global state, actions, and styles</p><h3 id="app-example">example /app.js</h3><div class="Pre light"><div class="menu"><button>dark</button><button>copy</button></div><pre><code class="line"><span class="keyword">module</span>.<span class="keyword">exports</span> = {</code><code class="line"> <span class="state">state</span>: {</code><code class="line"> <span class="colon">globalStateVar</span>: <span class="string">&#39;globally available&#39;</span>,</code><code class="line"> },</code><code class="line"> <span class="actions">actions</span>: {</code><code class="line"> <span class="colon">globalAction</span>: () =&gt; ({ <span class="colon">globalStateVar</span>: <span class="string">&#39;<span class="object">overwritten</span>.&#39;</span> }),</code><code class="line"> },</code><code class="line"> <span class="colon">style</span>: {</code><code class="line"> <span class="string">&#39;body&#39;</span>: {</code><code class="line"> <span class="colon">color</span>: <span class="string">&#39;green&#39;</span>,</code><code class="line"> },</code><code class="line"> },</code><code class="line">}</code></pre></div><h2 id="config">/config.js</h2><p>the /config.js file allows you to set various aspects of your app</p><h3 id="config-example">example /config.js</h3><div class="Pre light"><div class="menu"><button>dark</button><button>copy</button></div><pre><code class="line"><span class="keyword">module</span>.<span class="keyword">exports</span> = {</code><code class="line"> <span class="colon">ROOT</span>: <span class="string">&#39;example&#39;</span>,</code><code class="line"> <span class="colon">THEME</span>: <span class="string">&#39;blue&#39;</span>,</code><code class="line"> <span class="colon">WEB_ROOT</span>: <span class="string">&#39;/core/&#39;</span>,</code><code class="line"></code><code class="line"><span class="comment"> // <span class="keyword">this</span> option adds the</span></code><code class="line"><span class="comment"> // <span class="string">&#39;X-Clacks-Overhead&#39;</span>, <span class="string">&#39;GNU Terry Pratchet&#39;</span></span></code><code class="line"><span class="comment"> // http header</span></code><code class="line"><span class="comment"> // see<a href=" http://www.gnuterrypratchett.com/" target="_blank" rel="noopener"> http://www.gnuterrypratchett.com/</a></span></code><code class="line"> <span class="colon">FOR_DEATH_CAN_NOT_HAVE_HIM</span>: <span class="boolean">true</span>,</code><code class="line"></code><code class="line"><span class="comment"> // <span class="keyword">default</span> CLIENT_LIB_NAME, overwrite to change names of transpiled css and js files</span></code><code class="line"> <span class="colon">CLIENT_LIB_NAME</span>: <span class="string">&#39;magic&#39;</span>,</code><code class="line">}</code></pre></div><h2 id="menu">/assets/Menu.js</h2><p>the /assets/Menu.js file allows you to replace the default Menu component</p><h3 id="menu-example">example /assets/Menu.js</h3><a href="https://github.com/magic/core/blob/master/src/modules/Menu.js" target="_blank" rel="noopener">Menu.js on github</a></div><footer class="main"><div class="wrapper">made with a few bits of <a target="_blank" rel="noopener" href="https://github.com/magic/core">magic</a></div></footer></div></div><script src="/core/magic.js"></script></body></html>
Binary file modified docs/files/index.html.gz
Binary file not shown.
Loading

0 comments on commit 1d5d6f9

Please sign in to comment.