# AssetConverterInterface

> The AssetConverterInterface must be implemented by asset converter classes.

[API reference](/docs/api/index.md) › [yii](/docs/api/yii/index.md) › [web](/docs/api/yii/web/index.md) › AssetConverterInterface

| interface | `yii\web\AssetConverterInterface` |
| --- | --- |
| Since | 2.0 |
| Source | [`framework/web/AssetConverterInterface.php`](https://github.com/yiisoft/yii2/blob/22.0/framework/web/AssetConverterInterface.php#L17) |

Implemented by 1 type:

- [`AssetConverter`](/docs/api/yii/web/assetconverter/index.md)

The AssetConverterInterface must be implemented by asset converter classes.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`convert()`](#method-convert) abstract | Converts a given asset file into a CSS or JS file. | `AssetConverterInterface` |

## Method details

### convert() <span id="method-convert"></span>

```php
abstract public function convert(string $asset, string $basePath): string
```

Converts a given asset file into a CSS or JS file.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$asset` | `string` | The asset file path, relative to $basePath |
| `$basePath` | `string` | The directory the $asset is relative to. |

**Returns**

`string`: The converted asset file path, relative to $basePath.