Create a gist now

Instantly share code, notes, and snippets.

/*jslint node: true */
"use strict";
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-msbuild');
grunt.loadNpmTasks('grunt-aspnet-server');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-iisexpress');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
msbuild: {
dev: {
src: ['./MyProject/MyProject.csproj'],
options: {
projectConfiguration: 'Debug',
targets: ['Clean', 'Rebuild'],
version: 4.0,
maxCpuCount: 4,
buildParameters: {
WarningLevel: 2
},
verbosity: 'quiet'
}
}
},
iisexpress: {
server: {
options: {
path: './MyProject',
port: 3000
}
}
},
watch: {
csharp: {
files: ['./MyProject/**/*.cs', '!./MyProject/assets/**/*'],
tasks: ['msbuild:dev'],
options: {
livereload: true,
},
},
cshtml: {
files: ['./MyProject/**/*.cshtml', '!./MyProject/assets/**/*'],
tasks: [],
options: {
livereload: true,
},
},
sass: {
files: ['./MyProject/assets/sass/**/*'],
tasks: ['compass'],
options: {
livereload: true,
},
},
js: {
files: ['./MyProject/assets/js/**/*', '!./MyProject/assets/js/vendor/**/*'],
tasks: ['jshint'],
options: {
livereload: true,
},
},
vendorJs: {
files: ['./MyProject/assets/js/vendor/**/*'],
tasks: ['uglify'],
options: {
livereload: true,
},
}
},
compass: {
dev: {
options: {
sassDir: 'MyProject/assets/sass',
cssDir: 'MyProject/assets/css'
}
}
},
jshint: {
options: {
ignores: './MyProject/assets/js/vendor/**/*'
},
all: ['Gruntfile.js', './MyProject/assets/js/**/*']
},
uglify: {
options: {
beautify: true
},
vendorJs: {
files: [{
expand: true,
cwd: './MyProject/assets/js/vendor',
src: ['**/*.js', '!**/*.min.js'],
ext: '.min.js',
dest: './MyProject/assets/js/vendor'
}]
}
}
});
grunt.registerTask('default', ['iisexpress', 'msbuild:dev', 'compass', 'jshint', 'uglify', 'watch']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment