Ghost/Gruntfile.js

112 lines
3.1 KiB
JavaScript
Raw Normal View History

2013-05-14 19:04:22 +04:00
(function () {
"use strict";
var configureGrunt = function (grunt) {
var cfg = {
// JSLint all the things!
jslint: {
directives: {
node: true,
browser: true,
2013-05-14 19:04:22 +04:00
nomen: true,
todo: true,
unparam: true
2013-05-14 19:04:22 +04:00
},
files: [
// Lint files in the root, including Gruntfile.js
"*.js",
// Lint core files, but not libs
["core/**/*.js", "!**/assets/lib/**/*.js", "!**/assets/tmpl/*.js"]
2013-05-14 19:04:22 +04:00
]
},
2013-05-14 19:04:22 +04:00
mochaTest: {
options: {
ui: "bdd",
reporter: "spec"
},
all: {
src: ['core/test/**/*_spec.js']
},
api: {
src: ['core/test/**/api*_spec.js']
}
},
2013-05-14 19:04:22 +04:00
// Compile all the SASS!
sass: {
admin: {
files: {
'core/admin/assets/css/screen.css': 'core/admin/assets/sass/screen.scss'
}
}
},
2013-05-25 20:55:23 +04:00
shell: {
bourbon: {
command: 'bourbon install --path core/admin/assets/sass/modules/'
}
},
handlebars: {
core: {
options: {
namespace: "JST",
processName: function (filename) {
filename = filename.replace('./core/admin/assets/tmpl/', '');
return filename.replace('.hbs', '');
}
},
files: {
"./core/admin/assets/tmpl/hbs-tmpl.js": "./core/admin/assets/tmpl/**/*.hbs"
}
}
},
watch: {
handlebars: {
files: './core/admin/assets/tmpl/**/*.hbs',
tasks: ['handlebars']
}
2013-05-14 19:04:22 +04:00
}
2013-05-14 19:04:22 +04:00
};
2013-05-14 19:04:22 +04:00
grunt.initConfig(cfg);
2013-05-14 19:04:22 +04:00
grunt.loadNpmTasks("grunt-jslint");
grunt.loadNpmTasks("grunt-mocha-test");
grunt.loadNpmTasks("grunt-shell");
2013-05-14 19:04:22 +04:00
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-sass");
grunt.loadNpmTasks("grunt-contrib-handlebars");
2013-05-14 19:04:22 +04:00
// Prepare the project for development
// TODO: Git submodule init/update (https://github.com/jaubourg/grunt-update-submodules)?
grunt.registerTask("init", ["shell:bourbon", "sass:admin"]);
2013-05-14 19:04:22 +04:00
2013-05-20 08:22:00 +04:00
// Run API tests only
grunt.registerTask("test-api", ["mochaTest:api"]);
2013-05-20 08:22:00 +04:00
2013-05-14 19:04:22 +04:00
// Run tests and lint code
grunt.registerTask("validate", ["jslint", "mochaTest:all"]);
// When you just say "grunt"
grunt.registerTask("default", ['sass:admin', 'handlebars', 'watch']);
2013-05-14 19:04:22 +04:00
};
2013-05-14 19:04:22 +04:00
module.exports = configureGrunt;
2013-05-12 17:40:59 +04:00
2013-05-14 19:04:22 +04:00
}());