Skip to content

Latest commit

 

History

History
39 lines (32 loc) · 1.18 KB

README.md

File metadata and controls

39 lines (32 loc) · 1.18 KB

grow-ext-inline-text-assets

Extension for the static-site generator Grow that enables you to add textual asset dependencies via calls from your template.

Concept

This extension comes in handy if you want to use inline stylesheets for your project. To do so you could simply configure a asset bundle that you can then add files to just by calls from your templates.

And only for the files that are really needed in your template, instead of using pre-configured bundles.

Usage

Initial setup

  1. Create an extensions.txt file within your pod.
  2. Add to the file: git+git://github.com/jungvonmatt/grow-ext-inline-text-assets
  3. Run grow install.
  4. Add the following section to podspec.yaml:
ext:
- extensions.inline_text_assets.InlineTextAssetsExtension:
    bundles:
        - name: 'styles'
          method: 'addCssFile'
        - name: 'icons'
          method: 'useIcon'

This configuration adds two bundles to your documents that can be used in your templates with for example

{% if headline %}
{{ doc.styles.addCssFile('/css/headlines.css', 99) }}
<h1>{{ headline }}</h1>
{% endif %}
<style amp-custom>
{{ doc.styles.emit() }}
</style>