decouple task_class from javacsript and css

What is the difference if I edit the task_class or decouple the js from css using pure css besides being able to add logic before style change?

        gantt.templates.task_class = function (start, end, task) {
            if (task.type === gantt.config.types.project)
                return "gantt-project-task";

            return false;
        };

or this approach just modifying the gantt class directly?

.gantt_project { background: black !important; }

Hello,

When you modifying the gantt class directly, you set common color for all tasks with type project:
docs.dhtmlx.com/gantt/snippet/b32e3655

Using template is an easy way to set different colors for all type, if it’s needed:
docs.dhtmlx.com/gantt/snippet/5049e727

Thanks for the help.