Skip to content

Question: Partials with inline styling and/or scripting support ala content_for_header  #723

Description

@driekus77

Is it possible to use Partials with inline styling and/or scripting?

Sort of a content_for_header feature (See https://shopify.dev/docs/api/liquid/objects/content_for_header)

Or even beter a ViewComponent structure (Like Angular):

   Views\Components\MyNewComponent
           MyNewComponent.html  
           MyNewComponent.css
           MyNewComponent.js

So you have to have a Placeholder where to put the inline css and js e.g. inside layout.html:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8" />
    <title>{{ product_id }} - {{ product_title }} {{ product_type }}</title>
    <style>
        {{ 'styles.css' | inline_asset_content }} 
        
       {{ content_for_viewcomponents_stylesheet }}
    </style>
</head>
<body>
    {% viewcomponent 'MyNewComponent' %}

    <main role="main" id="MainContent">
        {% renderbody %}
    </main>

   <script>
       {{ content_for_viewcomponents_javascript }}
   </script>
</body>
</html>

Is the FluidViewEngine parser its extensibility sufficient to add above functionality?

Thanks in advance!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions