generated from yii-tools/template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3cbdc7b
commit 62aa510
Showing
50 changed files
with
1,459 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Change Log | ||
========== | ||
|
||
## 0.1.0 January 19, 2023 | ||
|
||
- Initial release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"symbol-whitelist": [ | ||
"YII_ENV" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
## Using assets | ||
|
||
Assets are files that are not processed by Webpack. They are copied directly to the output folder. This includes images, | ||
fonts, and any other files that you want to use in your project. | ||
|
||
To use an asset, you need to import it from JavaScript or CSS. | ||
|
||
Register the asset bundle with a view component such as a layout view. You can register it in a layout view so that it | ||
is available in all views that extend from this layout, or you can register it in a view that uses the asset. | ||
|
||
```php | ||
file: ./resources/views/layout/main.php | ||
|
||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Yii\Asset\Css\FontAwesome; | ||
|
||
/** | ||
* @var \Yiisoft\Assets\AssetManager $assetManager | ||
*/ | ||
|
||
// Register the asset bundle with a asset manager component. | ||
$assetManager->register(FontAwesome::class); | ||
|
||
// Set parameters for the registered asset bundle a view component. | ||
$this->addCssFiles($assetManager->getCssFiles()); | ||
$this->addCssStrings($assetManager->getCssStrings()); | ||
$this->addJsFiles($assetManager->getJsFiles()); | ||
$this->addJsStrings($assetManager->getJsStrings()); | ||
$this->addJsVars($assetManager->getJsVars()); | ||
``` | ||
|
||
Also you can register the asset bundle via container configuration: | ||
|
||
```php | ||
file: ./config/params.php | ||
|
||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Yii\Asset\Css\FontAwesomeCdn; | ||
|
||
return [ | ||
'yiisoft/assets' => [ | ||
'assetManager' => [ | ||
'register' => [ | ||
FontAwesomeCdn::class, | ||
], | ||
], | ||
], | ||
]; | ||
``` | ||
|
||
## Using npm packages | ||
|
||
You can install [npm](https://www.npmjs.com/) packages [fxpio/foxy](https://github.com/fxpio/foxy), and they will be | ||
available in the `node_modules` directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yii\Asset\Css\Depend; | ||
|
||
use Yiisoft\Assets\AssetBundle; | ||
|
||
final class DependCdn extends AssetBundle | ||
{ | ||
public bool $cdn = true; | ||
public array $css = ['https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/fontawesome.min.css']; | ||
public array $cssOptions = [ | ||
'integrity' => 'sha512-d0olNN35C6VLiulAobxYHZiXJmq+vl+BGIgAxQtD5+kqudro/xNMvv2yIHAciGHpExsIbKX3iLg+0B6d0k4+ZA==', | ||
'crossorigin' => 'anonymous', | ||
'referrerpolicy' => 'no-referrer', | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yii\Asset\Css; | ||
|
||
use Yiisoft\Assets\AssetBundle; | ||
use Yiisoft\Files\PathMatcher\PathMatcher; | ||
|
||
final class FontAwesome extends AssetBundle | ||
{ | ||
public string|null $basePath = '@assets'; | ||
public string|null $baseUrl = '@assetsUrl'; | ||
public string|null $sourcePath = '@fontawesome-free/css'; | ||
|
||
public function __construct() | ||
{ | ||
$pathMatcher = new PathMatcher(); | ||
|
||
$environment = defined('YII_ENV') ? YII_ENV : 'prod'; | ||
$cssFiles = $environment === 'prod' ? 'all.min.css' : 'all.css'; | ||
$fontAwesomeFile = $environment === 'prod' ? 'fontawesome.min.css' : 'fontawesome.css'; | ||
|
||
$this->css = [$cssFiles]; | ||
$this->publishOptions = [ | ||
'filter' => $pathMatcher->only("**/css/{$cssFiles}", "**/{$fontAwesomeFile}", '**/webfonts/*'), | ||
]; | ||
} | ||
} |
Oops, something went wrong.