Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/quickshiftin/mage2-ordered-assets
Order assets (read: css tags) explicitly with an order attribute
https://github.com/quickshiftin/mage2-ordered-assets
css magento2 order
Last synced: 12 days ago
JSON representation
Order assets (read: css tags) explicitly with an order attribute
- Host: GitHub
- URL: https://github.com/quickshiftin/mage2-ordered-assets
- Owner: quickshiftin
- License: mit
- Created: 2016-04-30T20:55:19.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-08-07T13:10:09.000Z (over 5 years ago)
- Last Synced: 2024-10-04T20:37:31.731Z (about 1 month ago)
- Topics: css, magento2, order
- Language: PHP
- Size: 33.2 KB
- Stars: 26
- Watchers: 3
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mage2-ordered-assets
Order assets (read: css tags) explicitly with an order attributeMagento2 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.
## Installation
### Composer
`composer require quickshiftin/assetorderer`### Manual
Download the repository and add it in your Magento2 installation under **app/code/Quickshiftin/Assetorderer**### Magento commands
Once you've installed the code via composer or download, you need to run some Magento commands:* `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```html
```
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
```html
```
Any tags without an explicit order will come as they appear normally (effectively treated like they have an order of 1).
### Unit Tests
To run the unit tests, in a working installation of Magento2, with the extension enabled* `cp vendor/quickshiftin/assetorderer/phpunit.xml dev/tests/unit`
* `cd dev/tests/unit`
* `php ../../../vendor/phpunit/phpunit/phpunit`