Download the PHP package ipub/assets-loader without Composer
On this page you can find all versions of the php package ipub/assets-loader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ipub/assets-loader
More information about ipub/assets-loader
Files in ipub/assets-loader
Package assets-loader
Short Description Extension for loading static CSS and JS files for Nette Framework
License GPL-2.0 GPL-3.0
Homepage https://github.com/iPublikuj/assets-loader
Informations about the package assets-loader
Assets loader
This package is abandoned and no longer maintained!
Extension for loading static CSS and JS files for Nette Framework
Installation
The best way to install ipub/assets-loader is using Composer:
or
After that you have to register extension in config.neon.
Package contains trait, which you will have to use in presenter to implement Assets Loader factory into Presenter. This works only for PHP 5.4+, for older version you can simply copy trait content and paste it into class where you want to use it.
Configuration
This extension has also ability to define different assets groups. So you can define assets for your frontend and for your backend separately like this:
And also this extension bring another feature Packages. So now you can define packages and this packages can be inserted into assets groups:
Now we have defined several packages and this packages can be used in all or some assets groups:
Usage in PHP files
Now you have to create components in your presenter. This components will server static files HTML elements. So in presenter just create two components:
Only one think what you have to set to createXXLoader() method is your asset name. If you don't use assets in groups, extension will use default asset. If you are using separated asset you can enter eg. frontend.
So this is all in PHP part. Extension is now fully integrated.
Using in Latte
In your layout latte template you can put components calls:
Available filters
File filters
coffeScriptFilter
Filter usable only for JavaScript files. This filter will compile your CoffeScripts into executable JS.
lessFilter
Filter usable only for CSS files. This filter will compile your Less files into clean CSS files.
cssUrlsFilter
Filter usable only for CSS files. This filter will convert all images into base64 encoded string, or if it is not a valid image for encoding, it will be converted to url created with routes.files route definition.
Content filters
scriptCompressor
Filter usable only for JavaScript files. This filter minify a Javascript string
styleCompressor
Filter usable only for CSS files. This filter minify a CSS string
cssImportFilter
Filter usable only for CSS files. This filter move import to the top of the document
Using IStaticFilesProvider
This extension also implement an interface for your extensions to automatically load static files. To use this functionality you have to implement IStaticFilesProvider interface into your extension and also one method getStaticFiles:
This static files provider copy the behaviour like in normal settings, so you can define here assets group or only define default asset.
All versions of assets-loader with dependencies
nette/application Version ~2.4
nette/caching Version ~2.4
nette/di Version ~2.4
nette/http Version ~2.4
nette/utils Version ~2.4
latte/latte Version ~2.4
leafo/lessphp Version ^0.5.0