Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

Questions about custom.css

Solved by pamtbaau View solution

Started by Urmm 8 years ago · 1 replies · 1284 views
8 years ago Solution

@ityoflaw
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:

    TWIG
    {% 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 %}
    
  3. 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.

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 95 15 hours ago
General · by pamtbaau, 20 hours ago
1 61 19 hours ago
General · by Andy Miller, 1 day ago
0 47 1 day ago
General · by Marcel, 12 months ago
6 356 5 days ago
General · by Duc , 6 days ago
3 44 6 days ago