Code Monkey home page Code Monkey logo

marko's Introduction

Marko

A declarative, HTML-based language that makes building web apps fun ๐Ÿ”ฅ

NPM Discord Build Status Coverage Status Downloads

Docs โˆ™ Try Online โˆ™ Contribute โˆ™ Get Support

Intro

Marko is HTML re-imagined as a language for building dynamic and reactive user interfaces. Just about any valid HTML is valid Marko, but Marko extends the HTML language to allow building modern applications in a declarative way.

Among these extensions are conditionals, lists, state, and components. Marko supports both single-file components and components broken into separate files.

Single file component

The following single-file component renders a button and a counter with the number of times the button has been clicked.

click-count.marko

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

style {
    .count {
        color:#09c;
        font-size:3em;
    }
    .example-button {
        font-size:1em;
        padding:0.5em;
    }
}

<div.count>
    ${state.count}
</div>
<button.example-button on-click('increment')>
    Click me!
</button>

Multi-file component

The same component as above split into an index.marko template file, component.js containing your component logic, and style.css containing your component style:

index.marko

<div.count>
    ${state.count}
</div>
<button.example-button on-click('increment')>
    Click me!
</button>

component.js

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

style.css

.count {
  color: #09c;
  font-size: 3em;
}
.example-button {
  font-size: 1em;
  padding: 0.5em;
}

Concise Syntax

Marko also supports a beautifully concise syntax as an alternative to its HTML syntax. Find out more about the concise syntax here.

<!-- Marko HTML syntax -->
<ul class="example-list">
    <for|color| of=['a', 'b', 'c']>
        <li>${color}</li>
    </for>
</ul>
// Marko concise syntax
ul.example-list
    for|color| of=['a', 'b', 'c']
        li -- ${color}

Getting Started

  1. npm install marko
  2. Read the docs

Community & Support

Ask and answer StackOverflow questions with the marko tag Come hang out in our Discord chat room, 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 โœจ

Get Involved!

  • Pull requests are welcome!
  • Read CONTRIBUTING.md and check out our bite-sized and help-wanted issues
  • Submit github issues for any feature enhancements, bugs or documentation problems
  • By participating in this project you agree to abide by its Code of Conduct.

License

MIT

marko's People

Contributors

abiyasa avatar agliga avatar aselvaraj avatar austinkelleher avatar bhavinpatel04 avatar bkuri avatar brywatsonnn avatar ccinelli avatar codinggirl avatar ctdio avatar dylanpiercey avatar gitter-badger avatar greenkeeper[bot] avatar hesulan avatar kristianmandrup avatar maberer avatar mlrawlings avatar newyork-anthonyng avatar oxala avatar patrick-steele-idem avatar philidem avatar ramahadevan avatar sandeepvattapparambil avatar scttdavs avatar seangates avatar sebring avatar tcrowe avatar tigt avatar yomed avatar zaiste avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.