Skip to content

gcpantazis/grunt-bliss

Repository files navigation

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>
      @[email protected]
    </div>
    @for(var p=0; p<products.length; p++) {
      @{ product = products[p] }
      <li>@product.name: ([email protected])</li>
    }
  </ul>

Output:

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

About

Grunt task for compiling Bliss templates

Resources

License

Stars

Watchers

Forks

Packages

No packages published