Giter Site home page Giter Site logo

grunt-dustjs's Introduction

grunt-dustjs

Grunt task to compile Dust.js templates.

Getting Started

Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-dustjs.

Then add this line to your project's grunt.js gruntfile:

grunt.loadNpmTasks('grunt-dustjs');

Documentation

Inside your grunt.js file, add a section named dustjs. This section specifies the Dust.js template files to compile.

files object

This defines what files this task will process and should contain key:value pairs.

The key (destination) should be an unique filepath (supports grunt.template) and the value (source) should be a filepath or an array of filepaths (supports minimatch).

Also, you can use fullname option to customize template variable name.

Example #1

// project configuration
grunt.initConfig({
  dustjs: {
    compile: {
      files: {
        "js/templates.js": ["src/templates/**/*.html"]
      }
    }
  },
});

Example #2 (custom template names)

// project configuration
grunt.initConfig({
  dustjs: {
    compile: {
      files: {
        "js/templates.js": ["src/templates/**/*.html"]
      },
      options: {
        fullname: function(filepath) {
          return path.relative('templates/all', path.dirname(filepath)).split(path.sep) // folder names
            .concat([path.basename(filepath, path.extname(filepath))]) // template name
            .join('.');
        }
      }
    }
  },
});

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

Release History

  • 08/12/2012 - 0.2: Add namespace support.
  • 25/09/2012 - 0.1.2: Initial release.

License

Copyright (c) 2012 Stanislav Lesnikov Licensed under the MIT license.

grunt-dustjs's People

Contributors

stah avatar chilts avatar powersusa avatar

Watchers

 avatar Will Colton avatar Karl Redgate avatar James Cloos avatar Jeff Dutton avatar  avatar  avatar Michael McGee avatar Bob Evans avatar Richard Sevigny avatar  avatar Ralph Navarro avatar Sandy Scott avatar  avatar Rich Johnson avatar Hisham Al-Beik avatar Kate Coyne avatar Brandon Chubb avatar  avatar Javier Marquez avatar Don Desjardin (HOME) avatar  avatar Ellen Fleischer avatar Jeffrey Somers avatar  avatar Jim McCollum avatar  avatar Lei Cao avatar Weibo Wang avatar Roy Lemmon avatar Steve Ching avatar Angel Pagan avatar Brian Smith avatar Marc Kazigian avatar David Reich avatar  avatar Stratus everRun UI avatar stratus-everrun-js avatar  avatar  avatar  avatar  avatar Wendy McNaughton avatar  avatar Grayson Xiao avatar Aldis Zhan avatar  avatar  avatar  avatar Witalij Witwicki 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.