Back

在grunt中使用jade

发布时间: 2015-02-24 08:27:00

refer to:  https://github.com/gruntjs/grunt-contrib-jade  and :  https://github.com/dbankier/JAST/blob/master/Gruntfile.js

grunt是node下的自动化工具,提供了很多自动化的插件,包括jade . 

1. $ https://github.com/gruntjs/grunt-contrib-jade

2. vim Gruntfile.coffee

grunt.loadNpmTasks('grunt-contrib-jade')

完整文件如下:

module.exports = (grunt) ->
  grunt.initConfig
    jade:
      compile:
        options:
          pretty: true
        files: [
          expand: true
          src: ['**/*.jade']
          dest: 'app' # 写成  'app/views' 也行,
          cwd: 'src'  # 如果 dest是'app/views', 这里就要是 'src/views'
          ext: '.xml'
        ]

  grunt.loadNpmTasks 'grunt-contrib-jade'
  grunt.registerTask 'default', [ 'jade' ]

3. 编译: $ grunt 

Back