Git Product home page Git Product logo

bowtie's Introduction

Bowtie

Build Status Coverage Status

Expressive template engine for Node.js heavily inspired by Jade.

Goals

This project aims to develop an expressive template language to write html documents using the dry and kiss principles. And of course, remove the pain of writing angle brackets.

Current status

This project is currently in it's pre-alpha stage. Current features:

  • Basic html output
  • Loops
  • If-Else
  • Mixins
  • Extending
  • Importing
  • Variables

Installation

$ npm install bowtie-js
Syntax highlighting

Syntax highlighting and auto completion is available for Atom editor. Syntax highlighting is triggered on .bow-files.

Install:

$ apm install atom-language-bowtie

Usage

With Gulp

Gulp compatible compiling comes out of the box with Bowtie, example:

var gulp = require('gulp');
var bowtie = require('bowtie-js').gulp;

gulp.task('bowtie', function() {
  return gulp.src('*.bow')
    .pipe(bowtie({
      // Pretty output
      "pretty": true,
      // Object to pass to template engine
      "locals": {
        "title": "Example application"
      }
    }))
    .pipe(gulp.dest('./dist'));
});

Example

!doctype("html")
html {
  head {
    title: $title
  }
  body {
    div.className {
      h1: "Example"
      p: "Hello world!"
    }
  }
}

The example above outputs:

<html>
    <head>
        <title>Example application</title>
    </head>
    <body>
        <div class="className">
            <h1>Example</h1>
            <p>Hello world!</p>
        </div>
    </body>
</html>

License

The MIT License

bowtie's People

Contributors

alveflo avatar

Stargazers

Kabir Goel avatar  avatar Martin Fylke avatar

Watchers

James Cloos avatar  avatar

bowtie's Issues

Markdown support

Support markdown document importing, i.e. import:markdown "foo.md"

escaping

Support escaping blocks, i.e.

:escape 
code
:end 

Alpha requirements

  • Pure templating (no variable assignments, modifications or interactions)
  • Basic looping
    • for ($i in (1..10))
    • for ($article in articles)
  • Mixins
  • If-else
  • String interpolation

browserify

fix a browser version in order to make an awesome presentation page

Tagparsing bugs

  1. Class names are not parsed correctly when they contain "-", e.g foo.bar-baz
  2. Link/script tags get file extensions as class names. E.g. script(href="foo.js") -> <script class="js" src="foo.js"></script>

Proposed

article -> (title, content) {
  h1: title
  p: content
}
html {
 head {
  title: Test
 }
 body {
  h1 Hello world
  p {
    Long paragraph
  }
 }
}

Mixins block support

In order to make mixins useful, they need to be able to take a block as "parameter", e.g.

$article -> ($title) {
 h1: $title
 div.foo.bar {
  bowtie:block
 }
}

$article("Foo") {
 // This becomes bowtie:block
 p: "Bar!"
}

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.