By webdevfreak on
I am using a twig template in my custom module (not theme folder) at this path: my_module/templates/mail-body.html.twig
I have problem attaching CSS with this template and need input how can I do this?
As per instructions on https://www.drupal.org/docs/8/creating-custom-modules/adding-stylesheets... page, I have used
{{ attach_library('my_module/mail-styling') }}
in my mail-body.html.twig file but still css is not loading.
Comments
use Asset injector for your custom page
Try to load your site in Dev mode and check whether its loading or not!
I will suggest you, go with common CSS in .libraries.yml and use CSS injector module for injecting unique CSS/JS for particular page.
https://www.drupal.org/project/asset_injector
thanks,
Sachin