#Get Grunting baby
Must have nodejs
, grunt
, npm
,
Not to mention you'll need to get grunt init
#####After that's done then start a grunting baby 😉
grunt-init gruntfile
initializes a basic gruntfile. More details
#Get Grunting baby
Must have nodejs
, grunt
, npm
,
Not to mention you'll need to get grunt init
#####After that's done then start a grunting baby 😉
grunt-init gruntfile
initializes a basic gruntfile. More details
Create a basic Gruntfile with grunt-init.
If you haven't already done so, install grunt-init.
Once grunt-init is installed, place this template in your ~/.grunt-init/
directory. It's recommended that you use git to clone this template into that directory, as follows:
git clone https://github.com/gruntjs/grunt-init-gruntfile.git ~/.grunt-init/gruntfile
(Windows users, see the documentation for the correct destination directory path)
At the command-line, cd into an empty directory, run this command and follow the prompts.
grunt-init gruntfile
Note that this template will generate files in the current directory, so be sure to change to a new directory first if you don't want to overwrite existing files.
######sample gruntfile
output from grunt init gruntfile
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
// Task configuration.
concat: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
dist: {
src: ['lib/<%= pkg.name %>.js'],
dest: 'dist/<%= pkg.name %>.js'
}
},
uglify: {
options: {
banner: '<%= banner %>'
},
dist: {
src: '<%= concat.dist.dest %>',
dest: 'dist/<%= pkg.name %>.min.js'
}
},
jshint: {
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
unused: true,
boss: true,
eqnull: true,
browser: true,
globals: {}
},
gruntfile: {
src: 'Gruntfile.js'
},
lib_test: {
src: ['lib/**/*.js', 'test/**/*.js']
}
},
qunit: {
files: ['test/**/*.html']
},
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint:gruntfile']
},
lib_test: {
files: '<%= jshint.lib_test.src %>',
tasks: ['jshint:lib_test', 'qunit']
}
}
});
// Default task.
grunt.registerTask('default', ['jshint', 'qunit', 'concat', 'uglify']);
};
#my bestest grunt plugs