Efficiently\Larasset\Commands\PrecompileAssetsCommand::fire PHP Method

fire() public method

Execute the console command.
public fire ( ) : mixed
return mixed
    public function fire()
    {
        parent::fire();
        if ($this->option('environment')) {
            # TODO: Remove the DEPRECATED stuff in the next minor version (0.10.0 or 1.0.0)
            $this->comment("WARN: The '--environment' option is DEPRECATED, use '--assets-env' option instead please.");
            $assetsEnv = $this->option('environment');
        } else {
            $assetsEnv = $this->option('assets-env');
        }
        $packagePath = $this->packagePath();
        $searchPaths = array_map(function ($path) {
            return $this->normalizePath($path);
        }, config('larasset.paths', []));
        putenv('LARASSET_PATH=' . implode('|', $searchPaths));
        $precompileFiles = array_map(function ($path) {
            return $this->normalizePath($path);
        }, config('larasset.precompile', []));
        putenv('LARASSET_PRECOMPILE=' . implode('|', $precompileFiles));
        putenv('LARASSET_ENV=' . $assetsEnv);
        putenv('LARASSET_COMMAND=precompile');
        putenv('LARASSET_PREFIX=' . config('larasset.prefix'));
        $enableSourceMaps = config('larasset.sourceMaps') === null ? true : config('larasset.sourceMaps');
        putenv('LARASSET_SOURCE_MAPS=' . ($enableSourceMaps ? 'true' : 'false'));
        $assetsPrecompileCommand = "larasset";
        // Precompile assets
        system("cd " . $packagePath . " && " . $assetsPrecompileCommand);
        // $this->deleteManifest();
        // $this->copyAssets();
    }