Skip to content

Instantly share code, notes, and snippets.

@furzeface
Last active August 29, 2015 14:07
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 furzeface/fb5c12caa05e3ffe15a2 to your computer and use it in GitHub Desktop.
Save furzeface/fb5c12caa05e3ffe15a2 to your computer and use it in GitHub Desktop.
Sample Gruntfile.js file for Yeoman generator.
/**
* @file Gruntfile
* @version <%= projectVersion %>
* @author {@link https://github.com/<%= yourGitHub %> <%= yourName %>}
*/
module.exports = function (grunt) {
// Time all the things
require('time-grunt')(grunt);
// Load all NPM tasks
require('load-grunt-tasks')(grunt, {scope: 'devDependencies', pattern: ['assemble', 'grunt-*']});
// Go!
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
bowerrc: grunt.file.readJSON('.bowerrc'),
meta: {
banner: '/* <%= _.slugify(projectName) %> :: Latest build: <%%= grunt.template.today(\'dd/mm/yyyy, h:MM:ss TT\') %> */\n'
},
config: {
// Component settings
bower: '<%%= bowerrc.directory %>',
// Source settings
src: 'app/src',
srcAssets: 'assets',
srcStyles: 'styles',
srcSass: 'sass',
srcScripts: 'scripts',
srcImages: 'images',
srcFonts: 'fonts',
// Dist settings
dist: 'app/dist',
distStyles: 'styles',
distScripts: 'scripts',
distImages: 'images',
distFonts: 'fonts',
distDocs: 'docs',
distJsDocs: 'jsdocs',
distSassDocs: 'sassdocs',
// File settings
mainCss: 'main.css',
gruntfile: 'Gruntfile.js',
// Misc settings
helpers: 'helpers'
},
// Project tasks
todo: {
options: {
colophon: true,
file: 'TODO.md',
marks: [{
name: 'todo',
pattern: /@(todo)/i,
color: 'blue'
}],
title: '[<%%= pkg.title%> TODO list:](<%= pkg.homepage %>)',
usePackage: true
},
all: [
'<%%= config.src %>/**/*.{hbs,html,js,scss,txt}',
'<%%= config.gruntfile %>',
// Exclude Bower installed components
'!<%%= config.bower %>'
]
},
devUpdate: {
force: {
options: {
updateType: 'force',
reportUpdated: false,
semver: false,
packages: {
dependencies: true,
devDependencies: true
},
packageJson: './package.json'
}
}
}
});
// Run setup task after install
grunt.registerTask('setup', [
'devUpdate',
'todo'
]);
// Defaults to dev task
grunt.registerTask('default', [
'dev'
]);
// Dev task
grunt.registerTask('dev', [
]);
// CI build task
grunt.registerTask('travis', [
]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment