- Notifications
You must be signed in to change notification settings - Fork649
A declarative, HTML-based language that makes building web apps fun
License
marko-js/marko
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A declarative, HTML-based language that makes building web apps fun 🔥
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.
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>
The same component as above, but split into:
index.marko
template filecomponent.js
component JS logic filestyle.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;}
Marko also supportsa beautifully concise syntax as an alternative to its HTML syntax:
Concise syntax | HTML 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> |
npm install marko
- Read thedocs
![]() | ![]() | ![]() |
---|---|---|
Ask and answerStackOverflow questions with the | Comehang out in our Discord chat, ask questions, and discuss project direction | Tweet to |
Marko would not be what it is without all those who have contributed ✨
- Pull requests are welcome!
- SubmitGitHub issues for any feature enhancements, bugs, or documentation problems
- Read the Contribution Tips and Guidelines
- Participants in this project agree to abide byits Code of Conduct
About
A declarative, HTML-based language that makes building web apps fun