Questions about custom.css

Regarding the custom.css that I read here:

1/ Is using custom.css the default way to overwrite all other css?

2/ If so, how to have it load as the last css?

3/ Is there a similar alternative for javascript?

To answer your questions point by point:

  1. Using custom.css is not the default way, but sure is the simplest way.
  2. If the theme you are using does use custom.css, it will add custom.css as last css.
    Have a look in user/themes/<your theme>/templates/partials/base.html.twig. You might find something like:
    {% block stylesheets %}
        {% do assets.addCss('theme://css-compiled/spectre'~compress) %}
        {% if theme_var('spectre.exp') %}{% do assets.addCss('theme://css-compiled/spectre-exp'~compress)  %}{% endif %}
        {% if theme_var('spectre.icons') %}{%  do assets.addCss('theme://css-compiled/spectre-icons'~compress) %}{% endif %}
        {% do assets.addCss('theme://css-compiled/theme'~compress) %}
        {% do assets.addCss('theme://css/custom.css') %}
        {% do assets.addCss('theme://css/line-awesome.min.css') %}
    {% endblock %}
  1. There is no custom.js… If you inherit base.html.twig in your own theme, you can add any js in a similar way as adding css. See the topic “Theme inheritance” in the same document you are referring to.