<commit_before><?php

namespace Contentify\Commands;

use Config;
use Illuminate\Console\Command;
use Less_Parser;

class LessCompileCommand extends Command
{

    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = 'less:compile';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = "Compile the theme's frontend and the backend LESS files to CSS files";

    /**
     * Create a new command instance.
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     */
    public function fire()
    {
        $theme = Config::get('app.theme');

        // Key = path, value = filename
        $lessFiles = [
            Config::get('modules.path').'/'.$theme.'/Resources/Assets/less/' => 'frontend',
            resource_path('assets/less/') => 'backend',
        ];

        foreach ($lessFiles as $sourcePath => $sourceFilename) {
            $this->compileLessFile($sourcePath, $sourceFilename);
        }
    }

    /**
     * Compiles a LESS file to a CSS file
     *
     * @param string $sourcePath
     * @param string $sourceFilename
     * @return void
     */
    protected function compileLessFile($sourcePath, $sourceFilename)
    {
        $debug = Config::get('app.debug');

        // Create a new instance for each file - or call the reset method
        $parser = new Less_Parser(['compress' => ! $debug]);<commit_msg>Refresh versioned asset paths when compiling LESS files<commit_after><?php

namespace Contentify\Commands;

use Config, Html;
use Illuminate\Console\Command;
use Less_Parser;

class LessCompileCommand extends Command
{

    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = 'less:compile';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = "Compile the theme's frontend and the backend LESS files to CSS files";

    /**
     * Create a new command instance.
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     */
    public function fire()
    {
        $theme = Config::get('app.theme');

        // Key = path, value = filename
        $lessFiles = [
            Config::get('modules.path').'/'.$theme.'/Resources/Assets/less/' => 'frontend',
            resource_path('assets/less/') => 'backend',
        ];

        foreach ($lessFiles as $sourcePath => $sourceFilename) {
            $this->compileLessFile($sourcePath, $sourceFilename);
        }

        Html::refreshAssetPaths();
    }

    /**
     * Compiles a LESS file to a CSS file
     *
     * @param string $sourcePath
     * @param string $sourceFilename
     * @return void
     */
    protected function compileLessFile($sourcePath, $sourceFilename)
    {
        $debug = Config::get('app.debug');

        // Create a new instance for each file - or call the reset method
        $parser = new Less_Parser(['compress' => ! $debug]);
{'fraction_non_alphanumeric': 0.12628865979381443, 'fraction_numerical': 0.0, 'mean_word_length': 2.2043343653250775, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2967431', 'n_tokens_mistral': 864, 'n_tokens_neox': 846, 'n_words': 236}