Introduction

Qingkuai is the pinyin of the Chinese word "轻快", conveying the framework's focus on being lightweight, fast to respond, and offering a more nimble development experience. It is a framework for building web interfaces and interactive features. It provides a programming model based on reactive variables and componentized interfaces, and uses a compiler to transform .qk source files into minimal, efficient, and strictly optimized JavaScript code.

When writing components, component scripts can be placed in embedded language tags. These tags all begin with lang-, such as lang-js. Content outside those tags is used to write the HTML template. Here is a simple component example:

qk
<lang-js>
    let count = 1
    let name = "World"

    setTimeout(() => {
        name = "Qingkuai"
    }, 1000)
</lang-js>

<h1> Hello {name}! </h1>

<button
    class="btn"
    @click={count++}
>
    You have clicked {count} times.
</button>

<lang-scss>
    // Add styles for the HTML elements in the component here...
</lang-scss>

Available embedded language tags include js, ts, css, scss, sass, less, postcss, and stylus. Note that code inside script and style tags is not processed by the compiler. Their raw content is preserved and inserted into the page exactly as in normal HTML:

qk
<script>
    // Insert a script tag with the same content into HTML
</script>

<style>
    /* Insert a style tag with the same content into HTML */
</style>

Design Philosophy

Qingkuai's syntax design philosophy is to introduce as little new syntax as possible and prioritize syntax habits already familiar from mainstream frameworks. Only when an existing design has clearly unreasonable parts does Qingkuai make necessary adjustments. This philosophy is intended to keep the learning curve low, so developers can get started quickly and focus on their actual work.

The choice not to use script and style as embedded language tags is not simply to make the framework feel unique. It is mainly for practical compatibility reasons: when those tags contain multiple attributes and line breaks, syntax highlighting based on Textmate breaks:

html
<style
    scoped
    lang="scss"
>
    /* scss cannot be highlighted correctly here */
</style>
If you have used Vue or Svelte, you will notice that Qingkuai's template syntax is similar to theirs in many ways. This similarity is intentional and meant to reduce the learning curve. However, behind that familiar syntax, its design trade-offs and implementation path still differ in meaningful ways.

Why Choose Qingkuai?

Compared with today's popular frontend frameworks, Qingkuai has the following core advantages:

@click adds a click event listener to the button element, and when the button is clicked it executes the JavaScript expression count++. More template syntax, including event listeners, will be introduced later.

Edit this page on github (This page has been translated from the Chinese version of the site. There may be inaccuracies in the translation. We welcome your help to improve the accuracy of this document.)