2012-09-11 02:12:23 +08:00
|
|
|
/*
|
|
|
|
* grunt-contrib-jst
|
|
|
|
* http://gruntjs.com/
|
|
|
|
*
|
|
|
|
* Copyright (c) 2012 Tim Branyen, contributors
|
|
|
|
* Licensed under the MIT license.
|
|
|
|
*/
|
|
|
|
|
|
|
|
module.exports = function(grunt) {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
// Project configuration.
|
|
|
|
grunt.initConfig({
|
|
|
|
lint: {
|
|
|
|
all: ['grunt.js', 'tasks/*.js', '<config:nodeunit.tasks>']
|
|
|
|
},
|
|
|
|
|
|
|
|
jshint: {
|
|
|
|
options: {
|
|
|
|
curly: true,
|
|
|
|
eqeqeq: true,
|
|
|
|
immed: true,
|
|
|
|
latedef: true,
|
|
|
|
newcap: true,
|
|
|
|
noarg: true,
|
|
|
|
sub: true,
|
|
|
|
undef: true,
|
|
|
|
boss: true,
|
|
|
|
eqnull: true,
|
|
|
|
node: true,
|
|
|
|
es5: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
// Before generating any new files, remove any previously-created files.
|
|
|
|
clean: {
|
|
|
|
test: ['tmp']
|
|
|
|
},
|
|
|
|
|
|
|
|
// Configuration to be run (and then tested).
|
|
|
|
jst: {
|
|
|
|
compile: {
|
|
|
|
files: {
|
2012-09-15 07:32:44 +08:00
|
|
|
"tmp/jst.js": ["test/fixtures/template.html"]
|
2012-09-11 02:12:23 +08:00
|
|
|
}
|
2012-09-12 23:34:53 +08:00
|
|
|
},
|
2012-11-27 02:01:28 +08:00
|
|
|
pretty_amd: {
|
|
|
|
options: {
|
|
|
|
prettify: true,
|
|
|
|
amdWrapper: true
|
|
|
|
},
|
|
|
|
files: {
|
|
|
|
"tmp/pretty_amd.js": ["test/fixtures/template.html"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
prettify: {
|
|
|
|
options: {
|
|
|
|
prettify: true
|
|
|
|
},
|
|
|
|
files: {
|
|
|
|
"tmp/pretty.js": ["test/fixtures/template.html"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
amd_wrapper: {
|
|
|
|
options: {
|
|
|
|
amdWrapper:true
|
|
|
|
},
|
|
|
|
files: {
|
|
|
|
"tmp/amd_wrapper.js": ["test/fixtures/template.html"]
|
|
|
|
}
|
|
|
|
},
|
2012-09-12 23:34:53 +08:00
|
|
|
uglyfile: {
|
|
|
|
files: {
|
2012-09-15 07:32:44 +08:00
|
|
|
"tmp/uglyfile.js": ["test/fixtures/*bad-filename*"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
ns_nested: {
|
|
|
|
options: {
|
|
|
|
namespace: "MyApp.JST.Main"
|
|
|
|
},
|
|
|
|
files: {
|
|
|
|
"tmp/ns_nested.js": ["test/fixtures/template.html"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
ns_nested_this: {
|
|
|
|
options: {
|
|
|
|
namespace: "this.MyApp.JST.Main"
|
|
|
|
},
|
|
|
|
files: {
|
|
|
|
"tmp/ns_nested_this.js": ["test/fixtures/template.html"]
|
2012-09-12 23:34:53 +08:00
|
|
|
}
|
2012-09-11 02:12:23 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
// Unit tests.
|
|
|
|
nodeunit: {
|
|
|
|
tasks: ['test/*_test.js']
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Actually load this plugin's task(s).
|
|
|
|
grunt.loadTasks('tasks');
|
|
|
|
|
|
|
|
// The clean plugin helps in testing.
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-clean');
|
|
|
|
|
|
|
|
// Whenever the "test" task is run, first clean the "tmp" dir, then run this
|
|
|
|
// plugin's task(s), then test the result.
|
|
|
|
grunt.renameTask('test', 'nodeunit');
|
|
|
|
grunt.registerTask('test', 'clean jst nodeunit');
|
|
|
|
|
|
|
|
// By default, lint and run all tests.
|
|
|
|
grunt.registerTask('default', 'lint test');
|
2012-11-27 02:01:28 +08:00
|
|
|
};
|