piczon Posted October 3, 2022 Share Posted October 3, 2022 (edited) Hello, I have a reusable "component.tpl" file, which I've placed in _partials folder (I import it in multiple pages) and I'd like to link a stylesheet (component.css) to this file/component. Now, every time I import this component to a page I create an additional 'component.css' linking in theme.yml. I'm looking for a solution to prevent this behaviour and declare stylesheet only once and load this stylesheet only on pages where component.tpl is imported. Anyone can give me any advice? Edited October 3, 2022 by piczon Added tags (see edit history) Link to comment Share on other sites More sharing options...
ps8modules Posted October 3, 2022 Share Posted October 3, 2022 (edited) Hi {block} <link rel="stylesheet" href="{$css_dir}component.css" type="text/css" media="{$media}" /> your tpl content {/block} Edited October 3, 2022 by 4you.software (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now