Skip to content

atrl/grunt-tplcompile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tplcompile

The best Grunt plugin ever.

Getting Started

This plugin requires Grunt ~0.4.4

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 tplcompile --save-dev

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

grunt.loadNpmTasks('tplcompile');

The "tplcompile" task

Overview

In your project's Gruntfile, add a section named tplcompile to the data object passed into grunt.initConfig().

grunt.initConfig({
  tplcompile: {
    default_options: {
      files: {
          src: ['test/fixtures/tpl/*.html']
      },
      options: {
          root : 'test/',
          wrap : 'seajs',
          output : 'default'
      }
    }
  },
});

Options

options.wrap

Type: String Default value: 'seajs'

wrap the js file to a seajs module or nodejs module

options.output

Type: String Default value: 'tmpl'

compiled file path

options.root

Type: String Default value: ''

seajs module define name

options.global

Type: Array Default value: []

global object list.

Usage Examples

Default Options

grunt.initConfig({
  default_options: {
    files: {
        src: ['test/fixtures/tpl/*.html']
    },
    options: {
        root : 'test/',
        wrap : 'seajs',
        output : 'default'
    }
  }
});

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

(Nothing yet)

About

compile html file to js function

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published