protected function get_css_content_from_less($themedesigner) {
        global $CFG;

        $lessfile = $this->lessfile;
        if (!$lessfile || !is_readable($this->dir . '/less/' . $lessfile . '.less')) {
            throw new coding_exception('The theme did not define a LESS file, or it is not readable.');
        }

        // We might need more memory/time to do this, so let's play safe.
        raise_memory_limit(MEMORY_EXTRA);
        core_php_time_limit::raise(300);

        // Files list.
        $files = $this->get_css_files($themedesigner);

        // Get the LESS file path.
        $themelessfile = $files['theme'][$lessfile];

        // Setup compiler options.
        $options = array(
            // We need to set the import directory to where $lessfile is.
            'import_dirs' => array(dirname($themelessfile) => '/'),
            // Always disable default caching.
            'cache_method' => false,
            // Disable the relative URLs, we have post_process() to handle that.
            'relativeUrls' => false,
        );

        if ($themedesigner) {
            // Add the sourceMap inline to ensure that it is atomically generated.
            $options['sourceMap'] = true;
            $options['sourceMapBasepath'] = $CFG->dirroot;
            $options['sourceMapRootpath'] = $CFG->wwwroot;
        }

        // Instantiate the compiler.
        $compiler = new core_lessc($options);

        try {
            $compiler->parse_file_content($themelessfile);

            // Get the callbacks.
            $compiler->parse($this->get_extra_less_code());
            $compiler->ModifyVars($this->get_less_variables());

            // Compile the CSS.
            $compiled = $compiler->getCss();

        } catch (Less_Exception_Parser $e) {
            $compiled = false;
            debugging('Error while compiling LESS ' . $lessfile . ' file: ' . $e->getMessage(), DEBUG_DEVELOPER);
        }

        // Try to save memory.
        $compiler = null;
        unset($compiler);

        return $compiled;
    }