AppSuite:GruntFAQ: Difference between revisions

From Open-Xchange
No edit summary
No edit summary
Line 3: Line 3:
== Some of my files aren't copied. How can I extend a copy sub-task? ==
== Some of my files aren't copied. How can I extend a copy sub-task? ==


Especially when using external libraries managed with Bower or npm, sometimes the shared grunt configuration doesn't contain all cases for files to be copied during the build or dist tasks. Due to the [https://johnyb.github.io/2014/05/10/extending_shared_grunt_configuration.html extensibility] of our shared grunt configuration, it's quite easy to add those missing files. You can hook up into the <tt>build_*</tt> or the <tt>dist_*</tt> copy task and add your custom configuration like this:
Especially when using external libraries managed with Bower or npm, sometimes the [https://github.com/Open-Xchange-Frontend/shared-grunt-config shared grunt configuration] doesn't contain all cases for files to be copied during the build or dist tasks. Due to the [https://johnyb.github.io/2014/05/10/extending_shared_grunt_configuration.html extensibility] of our shared grunt configuration, it's quite easy to add those missing files. You can hook up into the <tt>build_*</tt> or the <tt>dist_*</tt> copy task and add your custom configuration like this:


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">

Revision as of 11:21, 16 June 2014

FAQ regarding Grunt

Some of my files aren't copied. How can I extend a copy sub-task?

Especially when using external libraries managed with Bower or npm, sometimes the shared grunt configuration doesn't contain all cases for files to be copied during the build or dist tasks. Due to the extensibility of our shared grunt configuration, it's quite easy to add those missing files. You can hook up into the build_* or the dist_* copy task and add your custom configuration like this:

'use strict';

module.exports = function (grunt) {
    grunt.config.extend('copy', {
        build_custom: {
            files: [{
                expand: true,
                src: ['apps/**/*.in', 'apps/**/manifest.json'],
                dest: 'build/'
            }]
        }
    });
};

Put this in a file inside the grunt/tasks directory and you are done. From now on, all files ending with .in and all manifest.json files are put into the build/ directory using the same structure as in the apps/ directory. For more detailed information see the grunt documentation on files.