2017 © Pedro Peláez
 

magento2-module magento2-csspreload

Magento 2 module that allows loading of stylesheets with the preload attribute

image

meanbee/magento2-csspreload

Magento 2 module that allows loading of stylesheets with the preload attribute

  • Tuesday, April 17, 2018
  • by meanbee
  • Repository
  • 4 Watchers
  • 11 Stars
  • 466 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 8 Versions
  • 1 % Grown

The README.md

Magento 2 CSS Preload

Simple module that allows for asynchronous CSS loading in Magento 2, (*1)

Installation

  1. Go to your Magento root directory
  2. Run composer require meanbee/magento2-csspreload

Development

Setting up a development environment

A Docker development environment is included with the project:, (*2)

docker-compose run --rm cli magento-extension-installer Meanbee_CSSPreload
docker-compose up -d

Usage

To add assets to the block, provide the assets argument:, (*3)

<referenceBlock name="head.csspreload">
    <arguments>
        <argument name="assets" xsi:type="array">
            <item name="unique_name" xsi:type="array">
                <item name="path" xsi:type="string">css/filename.css</item>
                <item name="attributes" xsi:type="array">
                    <item name="name" xsi:type="string">attribute</item>
                    <item name="value" xsi:type="string">value</item>
                </item>
            </item>
        </argument>
    </arguments>
</referenceBlock>

To modify the template of the generated <link /> tags, provide a link_template argument, e.g.:, (*4)

<referenceBlock name="head.csspreload">
    <arguments>
        <argument name="link_template" xsi:type="string"><![CDATA[<link rel="preload" as="style" href=":path:" onload="this.rel='stylesheet'" :attributes: />]]></argument>
    </arguments>
</referenceBlock>

There are two variables that will be substituted: :path:, which will be replaced by the asset path, and :attributes: that will contain your attributes of your assets as HTML attributes., (*5)

The Versions

17/04 2018

dev-master

9999999-dev

Magento 2 module that allows loading of stylesheets with the preload attribute

  Sources   Download

MIT commercial

The Requires

 

by Darren Belding

17/04 2018

1.2.1

1.2.1.0

Magento 2 module that allows loading of stylesheets with the preload attribute

  Sources   Download

MIT

The Requires

 

by Darren Belding

17/04 2018

dev-firefox-preload

dev-firefox-preload

Magento 2 module that allows loading of stylesheets with the preload attribute

  Sources   Download

MIT

The Requires

 

by Darren Belding

16/04 2018

1.2.0

1.2.0.0

Magento 2 module that allows loading of stylesheets with the preload attribute

  Sources   Download

MIT

The Requires

 

by Darren Belding

30/11 2017

1.1.0

1.1.0.0

Magento 2 module that allows loading of stylesheets with the preload attribute

  Sources   Download

commercial

The Requires

 

by Darren Belding

27/11 2017

dev-4-m2.2-compatibility

dev-4-m2.2-compatibility

Magento 2 module that allows loading of stylesheets with the preload attribute

  Sources   Download

commercial

The Requires

 

by Darren Belding

05/07 2017

dev-support-php-5.6

dev-support-php-5.6

Magento 2 module that allows loading of stylesheets with the preload attribute

  Sources   Download

commercial

The Requires

 

by Darren Belding

28/02 2017

1.0.0

1.0.0.0

Magento 2 module that allows loading of stylesheets with the preload attribute

  Sources   Download

commercial

The Requires

 

by Darren Belding