module.exports = function(grunt) {
grunt.initConfig({
// Configuration des tâches
});
// Enregistrement d'une tâche
grunt.registerTask(taskName, [description, ] taskFunction)
// Chargement d'un plugin
grunt.loadNpmTasks('package');
};
module.exports = function(grunt) {
// Hello World Tasj grunt.registerTask('hello', function() { console.log('Hello World'); }); };
module.exports = function(grunt) {
// Hello World Task
grunt.registerTask('hello', function() {
console.log('Hello World');
});
// Bonjour le monde Task
grunt.registerTask('bonjour', function() {
console.log('Bonjour le monde');
});
// Alias Task
grunt.registerTask('default', ['bonjour', 'hello']);
};
grunt.initConfig({
log: {
foo: [1, 2, 3],
bar: 'hello world',
baz: false
}
});
grunt.registerMultiTask('log', function() {
// this.target
// this.data
});
module.exports = function(grunt) {
grunt.initConfig({
toto: {
tata: "Bla",
titi: "Bli"
}
});
grunt.registerMultiTask('toto', function() {
console.log(this.data);
});
};
grunt.initConfig({
toto: {
options: { key: "v1" },
target1: {
options: { key: "v2" },
},
target2: "Bli"
}
});
grunt.registerMultiTask('toto', function() {
var options = this.options({
tada: 'zoum'
});
});
grunt.initConfig({
task: {
options: '<%= param %>'
}
param: 'valeur'
});
npm install grunt-contrib-copy --save-dev
grunt.loadNpmTasks('grunt-contrib-copy');
copy: {
target: {
src: ['*.js', '*.json'],
dest: 'tmp/'
}
}
files: {
'dest file': 'src file',
'dest file': ['src files']
}
copy: {
task: {
files: {
'temp/': ['*.json', '*.js']
}
}
}
files: [
{src: 'fichier source', dest: 'destination'},
{src: ['fichiers sources'], dest: 'destination'}
]
copy: {
task: {
files: [
{src: ['*.json', '*.js'], dest: 'temp/'}
]
}
}
files: [{
expand: boolean,
cwd: string,
src: [string],
dest: string,
ext: string,
flatten: boolean,
rename: function
}]
imagemin: {
static: {
files: [{
expand: true,
cwd: 'src/',
src: ['**/*.{png,jpg,gif}'],
dest: 'dist/'
}]
}
}
module.exports = function(grunt) {
grunt.initConfig({
copy: {
scripts: {
files: [{
expand: true,
src: ['*.js'],
dest: 'tmp/'
}]
}
},
watch: {
scripts: {
files: ['*.js'],
tasks: ['copy'],
},
}
});
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
};
module.exports = function(grunt) {
grunt.initConfig({
carpenter: {
base: {
files: [
{
expand: true,
cwd: 'content/',
src: ['**/*.md'],
dest: 'dist',
ext: '.html'
}
]
}
}
});
grunt.loadNpmTasks('grunt-carpenter');
};