Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A declarative, HTML-based language that makes building web apps fun

License

NotificationsYou must be signed in to change notification settings

marko-js/marko

Repository files navigation

Marko

A declarative, HTML-based language that makes building web apps fun 🔥

NPMDiscord ChatContinuous Integration statusCode coverage %# of monthly downloadsOpenSSF Best Practices

DocsTry OnlineContributeGet Support

Intro

Marko is HTMLreimagined as a language for building dynamic and reactive user interfaces. Almost any valid HTML is valid Marko, and Marko extends HTML for building modern applications more declaratively. Among these extensions areconditionals and lists,state, andcomponents.

Marko supports both single-file components and components across separate files.

Single-file component

The following renders a button and a counter of how many times the button has been pressed:

click-count.marko

class {onCreate() {this.state= { count:0 };  }increment() {this.state.count++;  }}style {.count {color:#09c;font-size:3em;  }.press-me {padding:0.5em;  }}<output.count>${state.count}</output><button.press-meon-click('increment')>  Press me!</button>

Multi-file component

The same component as above, but split into:

  • index.marko template file
  • component.js component JS logic file
  • style.css component styles file

index.marko

<output.count>${state.count}</output><button.press-meon-click('increment')>  Press me!</button>

component.js

exportdefault{onCreate(){this.state={count:0};},increment(){this.state.count++;},};

style.css

.count {color:#09c;font-size:3em;}.press-me {padding:0.5em;}

Concise Syntax

Marko also supportsa beautifully concise syntax as an alternative to its HTML syntax:

Concise syntaxHTML syntax
ul.example-listfor|color|of=[a, b, c]li --${color}
<ulclass="example-list">  <for|color|of=[a, b, c]>    <li>${color}</li>  </for></ul>

Getting Started

  1. npm install marko
  2. Read thedocs

Community & Support

Stack OverflowDiscordTwitter

Ask and answerStackOverflow questions with the#marko tag

Comehang out in our Discord chat, ask questions, and discuss project direction

Tweet to@MarkoDevTeam, or with the#markojs hashtag

Contributors

Marko would not be what it is without all those who have contributed ✨

All marko-js/marko GitHub contributors

Get Involved!


[8]ページ先頭

©2009-2025 Movatter.jp