Skip to content

Instantly share code, notes, and snippets.

@adilwali
Last active December 14, 2015 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adilwali/5014268 to your computer and use it in GitHub Desktop.
Save adilwali/5014268 to your computer and use it in GitHub Desktop.
Basic Gruntfile for an Angular application. (Using Angular seed as the starting point for our project). Core dependencies: "grunt": "~0.4.0", "grunt-contrib-jshint": "0.1.1rc6", "grunt-contrib-nodeunit": "~0.1.2", "grunt-haml": "~0.3.1", "grunt-contrib-jade": "~0.4.0", "grunt-regarde": "~0.1.1", "grunt-contrib-copy": "~0.4.0" }
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
jade: {
files: ['app/**/*.jade'],
tasks: ['jade:compile']
},
haml: {
files: ['app/**/*.haml'],
tasks: ['haml:compile']
},
copy_assets: {
files: ['app/img/**'],
tasks: ['copy:assets']
},
copy_html: {
files: ['app/**/*.html'],
tasks: ['copy:html']
},
copy_js: {
files: ['app/**/*.js'],
tasks: ['copy:js']
},
copy_css: {
files: ['app/**/*.css'],
tasks: ['copy:css']
}
},
haml: {
compile: {
files: grunt.file.expandMapping(['app/**/*.haml'], 'output/', {
rename: function(base, path) {
return base + path.replace(/\.haml$/, '.html');
}
})
}
},
jade: {
compile: {
options: {
data: {
debug: false
}
},
files: grunt.file.expandMapping(['app/**/*.jade'], 'output/', {
rename: function(base, path) {
return base + path.replace(/\.jade$/, '.html');
}
})
}
},
copy: {
assets: {
files: [
{src: ['app/img/**'], dest: 'output/'},
{src: ['app/font/**'], dest: 'output/'}
]
},
html: {
files: [
{src: ['app/**/*.html'], dest: 'output/', filter: 'isFile'} // includes files in app/views and subdirectories. only with .html extension
]
},
js: {
files: [
{src: ['app/**/*.js'], dest: 'output/'}
]
},
css: {
files: [
{src: ['app/**/*.css'], dest: 'output/'}
]
}
}
});
grunt.loadNpmTasks('grunt-contrib-jade');
grunt.loadNpmTasks('grunt-regarde');
grunt.loadNpmTasks('grunt-haml');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.renameTask('regarde', 'watch');
grunt.registerTask('build', [
'haml:compile',
'jade:compile',
'copy'
]);
grunt.registerTask('default', ['build']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment