All Projects → meanbee → magento2-csspreload

meanbee / magento2-csspreload

Licence: MIT License
Asynchronous CSS loading in Magento 2 using rel="preload"

Programming Languages

javascript
184084 projects - #8 most used programming language
PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to magento2-csspreload

m2.ReCaptcha
Magento2. Extension is integrate Google Recaptcha with your Magento2 store.
Stars: ✭ 31 (+19.23%)
Mutual labels:  magento-extension, magento2-extension
magento2-prometheus-exporter
Simple Magento 2 Prometheus Exporter.
Stars: ✭ 40 (+53.85%)
Mutual labels:  magento-extension, magento2-extension
magento-grid-colors
Magento 2 Grid Colors module for colorizing admin grids. Supports saving of states with the help of grid's bookmarks.
Stars: ✭ 54 (+107.69%)
Mutual labels:  magento-extension, magento2-extension
magento-ngrok
Magento 2 module for ngrok.io service support
Stars: ✭ 45 (+73.08%)
Mutual labels:  magento-extension, magento2-extension
module-blog-comments-recaptcha
module-blog-comments-recaptcha
Stars: ✭ 17 (-34.62%)
Mutual labels:  magento-extension, magento2-extension
module-login-as-customer
Allows admin to login as a customer (enter to customer account).
Stars: ✭ 104 (+300%)
Mutual labels:  magento-extension, magento2-extension
magento2-catalog-lazy-load
Improve the load time of your Magento 2 categories pages by loading your images on demand with our Lazy Load Extension
Stars: ✭ 56 (+115.38%)
Mutual labels:  magento-extension, magento2-extension
m2.Price
Magento2. Rounding Price to Prettier Value for Multi-Currency Stores.
Stars: ✭ 60 (+130.77%)
Mutual labels:  magento-extension, magento2-extension
module-wysiwyg-advanced
Extend TinyMCE 4 & 5 tools in Magento 2
Stars: ✭ 60 (+130.77%)
Mutual labels:  magento-extension, magento2-extension
magento2-custom-shipping
Custom Shipping Module for Magento 2
Stars: ✭ 64 (+146.15%)
Mutual labels:  magento-extension, magento2-extension
module-translation
magefan.com/magento-2-translation-extension
Stars: ✭ 35 (+34.62%)
Mutual labels:  magento-extension, magento2-extension
module-lazyload
magefan.com/magento-2-image-lazy-load-extension
Stars: ✭ 47 (+80.77%)
Mutual labels:  magento-extension, magento2-extension
Brazilian-Solutions
Este repositório permite a discussão da comunidade brasileira Magento sobre módulos e soluções para o mercado brasileiro.
Stars: ✭ 19 (-26.92%)
Mutual labels:  magento-extension, magento2-extension
module-conflict-detector
magefan.com/magento2-conflict-detector
Stars: ✭ 40 (+53.85%)
Mutual labels:  magento-extension, magento2-extension
module-notifications
Notify the Magento 2 admin user about disabled caches or new customer reviews.
Stars: ✭ 20 (-23.08%)
Mutual labels:  magento-extension, magento2-extension
m2.SmartCategory
Magento2. Extension Smart Category rules dynamically change the product selection according to a set of conditions.
Stars: ✭ 78 (+200%)
Mutual labels:  magento-extension, magento2-extension
module-dsu-client
No description or website provided.
Stars: ✭ 17 (-34.62%)
Mutual labels:  magento-extension, magento2-extension
module-dsu
No description or website provided.
Stars: ✭ 18 (-30.77%)
Mutual labels:  magento-extension, magento2-extension
module-blog-sample-data
Sample data for Magento 2 blog extension
Stars: ✭ 15 (-42.31%)
Mutual labels:  magento-extension, magento2-extension
module-catalog
Fixes for some known Magento 2 issues in Catalog
Stars: ✭ 23 (-11.54%)
Mutual labels:  magento-extension, magento2-extension

Magento 2 CSS Preload

Simple module that allows for asynchronous CSS loading in Magento 2

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:

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:

<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.:

<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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].