How to apply css in theme development

ankitasoman - 4 months ago

Hi @ryanthompson, I am developing theme for my website. I am just stuck while linking and applying my css to the pages. metadata file contains the following snippet: {# Include Styles Loaded From Outside #} {% for style in asset_styles("styles.css") %} {{ style|raw }} {% endfor %}

I have created a directory named styles in resources directory of theme, and styles.css contains the css code. But styling does not get applied on page. How to do this??

piterden - 4 months ago

Did you try this? {{ asset_add("styles.css", "vendor.type.slug::css/style.css") }}

ankitasoman - 4 months ago

@piterden its not working :(

piterden - 4 months ago

vendor.type.slug must be yours. Show me, what did you write?

ankitasoman - 4 months ago

Hi @piterden it worked, I 've done that using sass. I just got confused in linked build.css file in metadata.twig. I got it. Thanks for the suggestion.