2017 © Pedro Peláez
 

magento2-module assetorderer

Ordering of CSS files for Magento2

image

quickshiftin/assetorderer

Ordering of CSS files for Magento2

  • Wednesday, May 17, 2017
  • by quickshiftin
  • Repository
  • 2 Watchers
  • 14 Stars
  • 1,315 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 1 Open issues
  • 5 Versions
  • 4 % Grown

The README.md

mage2-ordered-assets

Order assets (read: css tags) explicitly with an order attribute, (*1)

Magento2 has no way to order assets out of the box. This extension allows you to specify an order attribute in css tags in layout XML files and layout updates in the admin UI., (*2)

Installation

Composer

composer require quickshiftin/assetorderer, (*3)

Manual

Download the repository and add it in your Magento2 installation under app/code/Quickshiftin/Assetorderer, (*4)

Magento commands

Once you've installed the code via composer or download, you need to run some Magento commands:, (*5)

  • bin/magento module:enable Quickshiftin_Assetorderer
  • bin/magento setup:upgrade
  • rm -rf var/cache var/di var/generation var/page_cache && bin/magento setup:di:compile

Usage

Suppose you want to add a custom CSS file, css/home.css, on your homepage. Ordinarilly you would enter this in the layout update editor, (*6)

<head>
<css src="css/home.css"/>
</head>

However, Magento most likely will place the generated link tag before the base CSS file, thus not honoring the cascade. With the extension installed you can enter the css tag with an arbitrary order attribute like so, (*7)

<head>
<css src="css/home.css" order="100" />
</head>

Any tags without an explicit order will come as they appear normally (effectively treated like they have an order of 1)., (*8)

Unit Tests

To run the unit tests, in a working installation of Magento2, with the extension enabled, (*9)

  • cp vendor/quickshiftin/assetorderer/phpunit.xml dev/tests/unit
  • cd dev/tests/unit
  • php ../../../vendor/phpunit/phpunit/phpunit

The Versions

17/05 2017

dev-master

9999999-dev

Ordering of CSS files for Magento2

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

08/09 2016

1.0.3

1.0.3.0

Ordering of CSS files for Magento2

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

08/09 2016

1.0.1

1.0.1.0

Ordering of CSS files for Magento2

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

08/09 2016

1.0.0

1.0.0.0

Ordering of CSS files for Magento2

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

08/09 2016

dev-develop

dev-develop

Ordering of CSS files for Magento2

  Sources   Download

Copyright

The Development Requires

  • php >=5.4.0