private function build($dest = null, $plugin = null)
    {
        if ($plugin !== null) {
            /** @noinspection PhpIncludeInspection */
            $builds = file_exists($this->pluginManifestOfAssets) ? include $this->pluginManifestOfAssets : [];
            if (!isset($builds[$plugin])) {
                throw new InvalidArgumentException('Plugin "' . $plugin . '" has no assets or is not installed.');
            }
            /** @noinspection PhpIncludeInspection */
            $build = $builds[$plugin];
        }
        else {
            /** @noinspection PhpIncludeInspection */
            $build = require $this->buildFile;
        }

        // get only one asset if specified
        if ($dest !== null) {
            if (!isset($build[$dest])) {
                throw new InvalidArgumentException('Asset "' . $dest . '" is not defined.');
            }
            $build = [$dest => $build[$dest]];
        }

        // make relative path to absolute
        $basePath = base_path();
        foreach ($build as $asset => $sources) {
            foreach ($sources as $i => $source) {
                if (!is_absolute_path($source)) {
                    $build[$asset][$i] = $basePath . DIRECTORY_SEPARATOR . $source;
                }
            }
        }

        return $build;
    }