PHPackages                             dejvidecz/assets - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. dejvidecz/assets

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dejvidecz/assets
================

Fork of Modular assets system for Nette framework

1.0.3(4y ago)07MITPHP

Since Jan 23Pushed 4y agoCompare

[ Source](https://github.com/dejvidecz/Nette-Assets)[ Packagist](https://packagist.org/packages/dejvidecz/assets)[ RSS](/packages/dejvidecz-assets/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (8)Versions (5)Used By (0)

Fork of Carrooi/Assets
======================

[](#fork-of-carrooiassets)

[![Build Status](https://camo.githubusercontent.com/7f513951c9d1ae5fc502d8537e57951f961e6446f330e9faf4c656237b81d7e7/68747470733a2f2f7472617669732d63692e6f72672f436172726f6f692f4e657474652d4173736574732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Carrooi/Nette-Assets)[![Donate](https://camo.githubusercontent.com/8cc96460aacbf81849808e1dbd2543ce0e7d3cffc22adea26e6fcbaef75f26d2/687474703a2f2f622e7265706c2e63612f76312f646f6e6174652d50617950616c2d627269676874677265656e2e706e67)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WMC9CDEEYFJXC)

Simple modular assets system for Nette framework.

Installation
------------

[](#installation)

```
$ composer require dejvidecz/assets
$ composer update

```

Then just enable nette extension in your config.neon:

```
extensions:
	assets: Carrooi\Assets\DI\AssetsExtension
```

Configuration
-------------

[](#configuration)

```
extensions:
	assets: Carrooi\Assets\DI\AssetsExtension

assets:

	front:
		css:
			compiler: css
			paths:
				- %appDir%/../www/css/style.css
				- [mask: '*.css', from: %appDir%/../www/css/components]
				- [mask: '*.css', in: %appDir%/../www/css/core]
			target: %appDir%/../www/public/style.css
			publicPath: /public/style.css

		js:
			compiler: js
			paths:
				- %appDir%/../www/js
			target: %appDir%/../www/public/web.js
			publicPath: /public/web.js
```

Now we've got one namespace `front` with two resources `css` and `js`. You can create as many namespaces or resources as you want with any names.

Each resource needs its compiler, paths to compile and target built file with public path.

- **Compiler**: Currently just `css` or `js`. It can be also name of custom compiler class
- **Paths**: Names of files, directories or configurations for [nette/finder](https://github.com/nette/finder)
- **Target**: Path in file system to result file
- **PublicPath**: Path to built file accessible from browser

Usage
-----

[](#usage)

```
namespace App\Presenters;

use Nette\Application\UI\Presenter;

class BasePresenter extends Presenter
{

	/**
	 * @var \Carrooi\Assets\UI\IAssetsControlFactory
	 * @inject
	 */
	public $assetsControlFactory;

	/**
	 * @return \Carrooi\Assets\UI\AssetsControl
	 */
	protected function createComponentAssets()
	{
		return $this->assetsControlFactory->create();
	}

}
```

```
{control assets, front, css}
```

That will combine all our registered css files into one and add it to your template via our component.

Filters
-------

[](#filters)

```
public function __construct(\Carrooi\Assets\Assets $assets)
{
	$resource = $assets->getResource('front', 'css');
	$resource->getCompiler()->addFileFilter(function($file) {
		return "/* Author: John Doe */\n". $file;
	});
}
```

This file filter on compiler will prepend author's name before each compiled file.

Or there are also filters for final built files.

```
public function __construct(\Carrooi\Assets\Assets $assets)
{
	$resource = $assets->getResource('front', 'css');
	$resource->addFilter(function($file) {
		return "/* Built with Carrooi/Assets */\n". $file;
	});
}
```

This filter will add "Built with Carrooi/Assets" text to the beginning of target file.

Add paths
---------

[](#add-paths)

```
public function __construct(\Carrooi\Assets\Assets $assets)
{
	$resource = $assets->getResource('front', 'css');
	$resource->addPath(__DIR__. '/../../widget.css'); // just like in neon configuration
}
```

CompilerExtension
-----------------

[](#compilerextension)

Your compiler extensions can also implement `\Carrooi\Assets\DI\IAssetsProvider` interface for some additional configuration.

```
namespace App\DI;

use Carrooi\Assets\DI\IAssetsProvider;
use Nette\DI\CompilerExtension;

class AppExtension extends CompilerExtension implements IAssetsProvider
{

	/**
	 * @return array
	 */
	public function getAssetsConfiguration()
	{
		return [
			'front' => [
				'css' => [
					'paths' => [
						__DIR__. '/../widget.css',
					],
				],
			],
		]
	}

}
```

Changelog
---------

[](#changelog)

- 1.0.0

    - First version
- 1.0.1

    - IAssetsProvider::getAssetsFiles() renamed to ::getAssetsConfiguration() \[**BC Break**\]
- 1.0.2

    - Optimized dependencies
    - Removed unused exceptions
    - Optimized checking for files' modifications

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 55.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~859 days

Total

4

Last Release

1552d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f4c7aa903b54827e55a6c6dffb510196db750c8f8658fd78254765c24f93b073?d=identicon)[dejvidecz](/maintainers/dejvidecz)

---

Top Contributors

[![davidkudera](https://avatars.githubusercontent.com/u/1174072?v=4)](https://github.com/davidkudera "davidkudera (5 commits)")[![dejvidecz](https://avatars.githubusercontent.com/u/10745725?v=4)](https://github.com/dejvidecz "dejvidecz (3 commits)")[![wodCZ](https://avatars.githubusercontent.com/u/1174421?v=4)](https://github.com/wodCZ "wodCZ (1 commits)")

---

Tags

javascriptnettecssJSassetscarrooi

### Embed Badge

![Health badge](/badges/dejvidecz-assets/health.svg)

```
[![Health](https://phpackages.com/badges/dejvidecz-assets/health.svg)](https://phpackages.com/packages/dejvidecz-assets)
```

###  Alternatives

[matthiasmullie/minify

CSS &amp; JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.

2.0k30.5M336](/packages/matthiasmullie-minify)[stolz/assets

An ultra-simple-to-use assets management library

296519.2k8](/packages/stolz-assets)[janmarek/webloader

Tool for loading or deploying CSS and JS files into web pages

115514.4k14](/packages/janmarek-webloader)[sensiolabs/minify-bundle

Assets Minifier (CSS, JS) for Symfony &amp; Minify integration in Asset Mapper

5694.9k1](/packages/sensiolabs-minify-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
