lib/output/website/copyPluginAssets.js
function copyResources(output, plugin) {
    var logger = output.getLogger();

    var options    = output.getOptions();
    var outputRoot = options.get('root');

    var state = output.getState();
    var resources = state.getResources();

    var pluginRoot      = plugin.getPath();
    var pluginResources = resources.get(plugin.getName());

    var assetsFolder = pluginResources.get('assets');
    var assetOutputFolder = path.join(outputRoot, 'gitbook', plugin.getNpmID());

    if (!assetsFolder) {
        return Promise();
    }

    // Resolve assets folder
    assetsFolder = path.resolve(pluginRoot, assetsFolder);
    if (!fs.existsSync(assetsFolder)) {
        logger.warn.ln('assets folder for plugin "' + plugin.getName() + '" doesn\'t exist');
        return Promise();
    }

    logger.debug.ln('copy resources from plugin', assetsFolder);

    return fs.copyDir(
        assetsFolder,
        assetOutputFolder,
        {
            deleteFirst: false,
            overwrite: true,
            confirm: true
        }
    );
}
function copyResources(output, plugin) {
    var logger = output.getLogger();

    var options    = output.getOptions();
    var outputRoot = options.get('root');

    var state = output.getState();
    var resources = state.getResources();

    var pluginRoot      = plugin.getPath();
    var pluginResources = resources.get(plugin.getName());

    var assetsFolder = pluginResources.get('assets');
    var assetOutputFolder = path.join(outputRoot, 'gitbook', plugin.getNpmID());

    if (!assetsFolder) {
        return Promise();
    }

    // Resolve assets folder
    assetsFolder = path.resolve(pluginRoot, assetsFolder);
    if (!fs.existsSync(assetsFolder)) {
        logger.warn.ln('assets folder for plugin "' + plugin.getName() + '" doesn\'t exist');
        return Promise();
    }

    logger.debug.ln('copy resources from plugin', assetsFolder);

    return fs.copyDir(
        assetsFolder,
        assetOutputFolder,
        {
            deleteFirst: false,
            overwrite: true,
            confirm: true
        }
    );
}
function copyResources ( output , plugin ) { var logger = output . getLogger ( ) ; var options = output . getOptions ( ) ; var outputRoot = options . get ( 'root' ) ; var state = output . getState ( ) ; var resources = state . getResources ( ) ; var pluginRoot = plugin . getPath ( ) ; var pluginResources = resources . get ( plugin . getName ( ) ) ; var assetsFolder = pluginResources . get ( 'assets' ) ; var assetOutputFolder = path . join ( outputRoot , 'gitbook' , plugin . getNpmID ( ) ) ; if ( ! assetsFolder ) { return Promise ( ) ; } // Resolve assets folder assetsFolder = path . resolve ( pluginRoot , assetsFolder ) ; if ( ! fs . existsSync ( assetsFolder ) ) { logger . warn . ln ( 'assets folder for plugin "' + plugin . getName ( ) + '" doesn\'t exist' ) ; return Promise ( ) ; } logger . debug . ln ( 'copy resources from plugin' , assetsFolder ) ; return fs . copyDir ( assetsFolder , assetOutputFolder , { deleteFirst : false , overwrite : true , confirm : true } ) ; }
Copy resources from a plugin

@param {Plugin}
@return {Promise}
Copy resources from a plugin