2017 © Pedro Peláez
 

library web-asset-loader

Nette extension for loading JS and CSS into template.

image

ibr/web-asset-loader

Nette extension for loading JS and CSS into template.

  • Tuesday, February 28, 2017
  • by ibrconsulting
  • Repository
  • 2 Watchers
  • 0 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Web Asset Loader

Nette extension for loading JS and CSS into template., (*1)

Assets gets loaded into the page in the exact order as you define it. This is useful for loading libraries (jQuery) first or overriding css., (*2)

Installation

You can install WebAssetLoader using Composer:, (*3)

composer require ibr/web-asset-loader

Example with Nette Framework extension

Configuration in config.neon, (*4)

extensions:
    webAssetLoader: IBR\WebAssetLoader\Nette\Extension

webAssetLoader:
    js:
        - path/to/file/file1.js
        - path/to/file/file2.js
    css:
        - path/to/file/file1.css
        - path/to/file/file2.css

Usage in BasePresenter.php (need to pass the instance of the control and create component), (*5)

use \IBR\WebAssetLoader\Loader as WebAssetLoader;

abstract class BasePresenter extends \Nette\Application\UI\Presenter
{
    /**
     * @var WebAssetLoader
     * @inject
     */
    public $webAssetLoader;

    public function createComponentWebAssetLoader()
    {
        return $this->webAssetLoader;
    }

}

Usage in @layout.latte (or any template), (*6)

{control webAssetLoader:css}

{control webAssetLoader:js}

Result, (*7)

<link rel="stylesheet" href="{$basePath}/path/to/file/file1.css">
<link rel="stylesheet" href="{$basePath}/path/to/file/file2.css">



The Versions

28/02 2017

dev-master

9999999-dev https://github.com/IBRConsulting/WebAssetLoader

Nette extension for loading JS and CSS into template.

  Sources   Download

MIT

The Requires

 

by Vojtěch Lank

24/02 2017

1.0.0

1.0.0.0 https://github.com/IBRConsulting/WebAssetLoader

Nette extension for loading JS and CSS into template.

  Sources   Download

MIT

The Requires

 

by Vojtěch Lank