Grunt task for compiling Bliss templates
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
tasks
test
.gitignore
.jshintrc
.travis.yml
CONTRIBUTING.md
Gruntfile.js
LICENSE-MIT
README.md
package.json
version-update.js

README.md

grunt-bliss Build Status

Compile Bliss templates.

Getting Started

This plugin requires Grunt ~0.4.1

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

  npm install grunt-bliss --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

  grunt.loadNpmTasks('grunt-bliss');

Bliss task

Run this task with the grunt bliss command.

Configuration

  bliss: {
    options: {
      context: {
        data: {
          day: 10,
          year: 1999
        }
      }
    },
    compile: {
      files: {
        'tmp/bliss.html': ['test/fixtures/bliss.js.html']
      },
      options: {
        context: {
          data: {
            year: '2013'
          }
        }
      }
    }
  }

Related template (bliss.js.html):

  @{
    products = [{
      name: "foo",
      price: 123
    },{
      name: "bar",
      price: 123
    }]
  }

  <ul>
    <div>
      @data.year-@data.day
    </div>
    @for(var p=0; p<products.length; p++) {
      @{ product = products[p] }
      <li>@product.name: ($@product.price)</li>
    }
  </ul>

Output:

  <ul>
    <div>2013-10</div>
    <li>foo: ($123)</li>
    <li>bar: ($123)</li>
  </ul>