<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: mast1ff</title>
    <description>The latest articles on DEV Community by mast1ff (@mast1ff).</description>
    <link>https://dev.to/mast1ff</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F666414%2F87561d44-9299-4f13-a22b-3398cb3e3563.png</url>
      <title>DEV Community: mast1ff</title>
      <link>https://dev.to/mast1ff</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mast1ff"/>
    <language>en</language>
    <item>
      <title>MiuJS: a framework for building HTML applications packed with the minimum necessary functionality</title>
      <dc:creator>mast1ff</dc:creator>
      <pubDate>Wed, 27 Apr 2022 02:28:42 +0000</pubDate>
      <link>https://dev.to/mast1ff/miujs-a-framework-for-building-html-applications-packed-with-the-minimum-necessary-functionality-2ca6</link>
      <guid>https://dev.to/mast1ff/miujs-a-framework-for-building-html-applications-packed-with-the-minimum-necessary-functionality-2ca6</guid>
      <description>&lt;h1&gt;
  
  
  MiuJS in a minute
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://github.com/tknf/miujs"&gt;Github&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;MiuJS is a full-stack framework running on Node.js that includes utilities necessary for developing small websites.&lt;br&gt;
It does not rely on specific front-end libraries such as React or Vue.js, yet packs as many features as possible that are necessary for development.&lt;/p&gt;
&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Runs server-side instead of SSG&lt;/li&gt;
&lt;li&gt;Built-in controller to handle non-GET requests&lt;/li&gt;
&lt;li&gt;HTML-first development using Nunjucks templates, pre-built templates to avoid using &lt;code&gt;fs&lt;/code&gt; in production&lt;/li&gt;
&lt;li&gt;Scoped CSS feature, no mass production of CSS files&lt;/li&gt;
&lt;li&gt;No external library dependencies for client-side JavaScript bundles (initial 5kb or less in production builds!)&lt;/li&gt;
&lt;li&gt;Built-in dev server with live reload and built-in production server with connect&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Recommended for
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Creating web pages that do not want to overload the client-side&lt;/li&gt;
&lt;li&gt;Lightweight websites that are not platform specific&lt;/li&gt;
&lt;li&gt;Corporate sites with templates + small amount of POST actions, etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Incompatibility
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Large scale website and web application development&lt;/li&gt;
&lt;li&gt;SPA development&lt;/li&gt;
&lt;li&gt;Blogs and documentation sites with large amounts of local Markdown&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Although the above is a narrow demand, I believe that it can be useful for those who fell that existing frameworks are over-specified when they want to speed up the construction of a small site.&lt;br&gt;
If you are interested, please continue reading.&lt;/p&gt;



&lt;p&gt;As of 2022, there are countless libraries and mods named "web frameworks" regardless of languages.&lt;br&gt;
When developing the actual core software of a product, large frameworks such as Ruby on Rails and Django may be used.&lt;/p&gt;

&lt;p&gt;However, if you are building a website just to introduce that product, for example, these frameworks feel over-engineered.&lt;br&gt;
There are various options to solve this, but the main issues I felt were:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I love React used by Next.js, Remix, etc., but the bundle size is a concern for creating a small site.&lt;/li&gt;
&lt;li&gt;Sveltekit made by Svelte as well as 1.&lt;/li&gt;
&lt;li&gt;CMSs such as Wordpress are similarly over-specified and have too many files to begin with.&lt;/li&gt;
&lt;li&gt;There is an option to use a static site generator (e.g. Hugo), but it needs to be built every time data is updated.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In other words, what I wanted was:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Requires few or no development time&lt;/li&gt;
&lt;li&gt;Small in size&lt;/li&gt;
&lt;li&gt;Runs on the server-side&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Considering the existing options
&lt;/h2&gt;

&lt;p&gt;First, I narrowed down our choices of frameworks that could satisfy the above.&lt;/p&gt;

&lt;p&gt;I tried various small frameworks such as &lt;a href="http://sinatrarb.com/"&gt;Sinatra&lt;/a&gt; and &lt;a href="https://gin-gonic.com/"&gt;Gin&lt;/a&gt;, but I felt that most of them are based on the assumption of customization to the extent that they extend the HTTP router.&lt;/p&gt;

&lt;p&gt;The goal of this project is to develop a small website. I wanted a utility that specializes in front-end rather than extensibility.&lt;/p&gt;

&lt;p&gt;Therefore, &lt;strong&gt;I decided to create our own framework&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Create a framework
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Requirements
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Ability to use template engines with low learning costs&lt;/li&gt;
&lt;li&gt;Support for server-side rendering&lt;/li&gt;
&lt;li&gt;Not a static site generator&lt;/li&gt;
&lt;li&gt;Built-in HTTP server, capable of handing POST requests&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Additional
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;JavaScript bundling&lt;/li&gt;
&lt;li&gt;Can use scoped CSS, or CSS modules, etc.&lt;/li&gt;
&lt;li&gt;Can run without JavaScript&lt;/li&gt;
&lt;li&gt;Live reload during development&lt;/li&gt;
&lt;li&gt;No &lt;code&gt;fs&lt;/code&gt; in server runtime (want to run with Vercel, Netlify, etc.)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I have developed a web framework that can satisfy these requirements as much as possible.&lt;/p&gt;
&lt;h1&gt;
  
  
  MiuJS
&lt;/h1&gt;

&lt;p&gt;The result is MiuJS, which meets all of the above requirements.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.miujs.com"&gt;MiuJS Website&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  From project creation to build
&lt;/h2&gt;

&lt;p&gt;As detailed use is described on our website, I will only provide a simplified introduction.&lt;/p&gt;
&lt;h3&gt;
  
  
  Create project
&lt;/h3&gt;

&lt;p&gt;It can be created from npx by the &lt;code&gt;create-miu&lt;/code&gt; package.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-miu@latest my-project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this stage, the deployment targets can be selected from built-in server, Netlify, and Vercel, each with templates for JavaScript and TypeScript.&lt;/p&gt;

&lt;h3&gt;
  
  
  Development
&lt;/h3&gt;

&lt;p&gt;Built-in dev server with live reload.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn dev
&lt;span class="c"&gt;# or &lt;/span&gt;
npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Request workflow
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jKRi_toY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sxy7bow9c42hfgdhia55.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jKRi_toY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sxy7bow9c42hfgdhia55.jpg" alt="Image description" width="800" height="400"&gt;&lt;/a&gt;&lt;br&gt;
MiuJS server requests are processed in the following order:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Request handlers created for each platform, such as &lt;code&gt;createVercelRequestHandler&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Function calls corresponding to request methods such as &lt;code&gt;get&lt;/code&gt;, &lt;code&gt;post&lt;/code&gt; described in files under &lt;code&gt;src/routes&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;createServerRequest&lt;/code&gt; function in &lt;code&gt;src/entry-server.js&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Basically, each Route file plays the role of a controller in MVC, and detailed processing can be described here.&lt;/p&gt;
&lt;h3&gt;
  
  
  Route files
&lt;/h3&gt;

&lt;p&gt;Under &lt;code&gt;src/routes&lt;/code&gt;, Next.js-like file system routing in employed, with &lt;code&gt;src/routes/index.js&lt;/code&gt; automatically routed to &lt;code&gt;/&lt;/code&gt;, &lt;code&gt;src/routes/about.js&lt;/code&gt; to &lt;code&gt;/about&lt;/code&gt;, and so on.&lt;br&gt;
In addition, each Route file can be implemented by exporting a function with an HTTP method name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;RouteAction&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;miujs/node&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;json&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;miujs/node&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// http://localhost:3000/posts#GET&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;RouteAction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;createContent&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;createContent&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;layout&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;default&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}),&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="c1"&gt;// http://localhost:3000/posts#POST&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;RouteAction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;params&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`query: `&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`params: `&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({},&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Templating
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;createContent&lt;/code&gt; function passed from &lt;code&gt;RouteAction&lt;/code&gt; has a built-in mechanism for using template files from cached post-build Nunjucks templates without using &lt;code&gt;fs&lt;/code&gt;, and this function can be used to generate html rendered Nunjucks from the specified directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;RouteAction&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;miujs/node&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;render&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;miujs/node&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;RouteAction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;createContent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;params&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetchSource&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;handle&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handle&lt;/span&gt; &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;createContent&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;layout&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;404&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}),&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;404&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nf"&gt;createContent&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;layout&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;default&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Templates that are entry points that reference files under src/layouts&lt;/span&gt;
      &lt;span class="na"&gt;sections&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="c1"&gt;// Section name and scope variables that reference to files under src/sections&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;header&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Akiyoshi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;],&lt;/span&gt;
      &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="c1"&gt;// Global data&lt;/span&gt;
    &lt;span class="p"&gt;}),&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Cache-Control&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;public, max-age=900&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- layouts/default.njk --&amp;gt;&lt;/span&gt;
&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;{{ data.title }}&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    The contents of the `sections` are compiled and inserted in the following comment fragment.
    &lt;span class="c"&gt;&amp;lt;!-- content --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- sections/header.njk --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;header&amp;gt;&lt;/span&gt;
  The `settings` scope provides access to section-specific scope variables.
&lt;span class="nt"&gt;&amp;lt;/header&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Scoped CSS
&lt;/h2&gt;

&lt;p&gt;Scoped CSS can be applied to content in &lt;code&gt;src/partials&lt;/code&gt; and &lt;code&gt;src/sections&lt;/code&gt; with markup like Vue.js or Svelte.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;style &lt;/span&gt;&lt;span class="na"&gt;scoped&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nc"&gt;.price&lt;/span&gt;&lt;span class="nd"&gt;:scope&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;template&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"price"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;small&amp;gt;&lt;/span&gt;$&lt;span class="nt"&gt;&amp;lt;/small&amp;gt;&lt;/span&gt;{{ price }}&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/template&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Build
&lt;/h3&gt;

&lt;p&gt;Build is also completed with a single command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn build
&lt;span class="c"&gt;# or &lt;/span&gt;
npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Build for each server target (node, netlify, vercel) based on the settings described in miu.config.js.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deploy
&lt;/h3&gt;

&lt;p&gt;The built-in server works only with Node.js, so it can be deployed to any environment where the Node.js runtime is available.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn serve
&lt;span class="c"&gt;# or &lt;/span&gt;
npm run serve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Deploying to services that use serverless functions such as Vercel or Netlify requires some tricky configuration, but the templates in the &lt;code&gt;create-miu&lt;/code&gt; package include configuration files, so you can deploy without configuration, except in cases where special handling is required.&lt;/p&gt;




&lt;h2&gt;
  
  
  Future implementations
&lt;/h2&gt;

&lt;p&gt;This framework is intended to meet the niche demand of developing "small websites that need a server-side but do not want to be as over-specified as existing full-stack frameworks.&lt;/p&gt;

&lt;p&gt;In implementing the necessary functionality, most of the code, such as session storage, is implemented in time by copying parts of it from frameworks I admire, such as Remix. Since MiuJS is not intended to be used for developing large-scale applications, the usage scenario may be limited to begin with.&lt;/p&gt;




&lt;p&gt;If anyone matches this narrow demand, please use it if you like.&lt;/p&gt;

&lt;p&gt;Thanks for reading.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/tknf/miujs"&gt;MiuJS Github&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.miujs.com"&gt;MiuJS website&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I plan to rewrite this area so that it can be used more simply in a PHP-like manner.&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>typescript</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
