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; }


When you modifying the gantt class directly, you set common color for all tasks with type project:

Using template is an easy way to set different colors for all type, if it’s needed:

Thanks for the help.