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
cee38f5
commit 7b38522
Showing
26 changed files
with
715 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,6 @@ phpunit.phar | |
|
||
# windows thumbnail cache | ||
Thumbs.db | ||
|
||
#package-lock.json | ||
/package-lock.json |
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,57 @@ | ||
## 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\DatePicker\Asset\Npm\Dev\DatePickerBootstrap5Asset; | ||
|
||
/** | ||
* @var \Yiisoft\Assets\AssetManager $assetManager | ||
*/ | ||
|
||
// Register the asset bundle with a asset manager component. | ||
$assetManager->register(DatePickerBootstrap5Asset::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\DatePicker\Asset\Cdn\DatePickerBootstrap5Asset; | ||
|
||
return [ | ||
'yiisoft/assets' => [ | ||
'assetManager' => [ | ||
'register' => [ | ||
DatePickerBootstrap5Asset::class, | ||
], | ||
], | ||
], | ||
]; | ||
``` | ||
|
||
## Using npm packages | ||
|
||
[npm](https://www.npmjs.com/) packages are installed via [fxpio/foxy](https://github.com/fxpio/foxy) and are 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "vainilla-datepicker", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"vanillajs-datepicker": "^1.2.0" | ||
}, | ||
"license": "mit" | ||
} |
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,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yii\DatePicker\Asset\Cdn; | ||
|
||
use Yiisoft\Assets\AssetBundle; | ||
|
||
final class DatePickerAsset extends AssetBundle | ||
{ | ||
public bool $cdn = true; | ||
public array $js = ['https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.2.0/dist/js/datepicker-full.min.js']; | ||
} |
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,14 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yii\DatePicker\Asset\Cdn; | ||
|
||
use Yiisoft\Assets\AssetBundle; | ||
|
||
final class DatePickerBootstrap5Asset extends AssetBundle | ||
{ | ||
public bool $cdn = true; | ||
public array $css = ['https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.2.0/dist/css/datepicker-bs5.min.css']; | ||
public array $depends = [DatePickerAsset::class]; | ||
} |
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,14 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yii\DatePicker\Asset\Cdn; | ||
|
||
use Yiisoft\Assets\AssetBundle; | ||
|
||
final class DatePickerBulmaAsset extends AssetBundle | ||
{ | ||
public bool $cdn = true; | ||
public array $css = ['https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.2.0/dist/css/datepicker-bulma.min.css']; | ||
public array $depends = [DatePickerAsset::class]; | ||
} |
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,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yii\DatePicker\Asset\Cdn; | ||
|
||
use Yiisoft\Assets\AssetBundle; | ||
|
||
final class DatePickerFoundationAsset extends AssetBundle | ||
{ | ||
public bool $cdn = true; | ||
public array $css = [ | ||
'https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.2.0/dist/css/datepicker-foundation.min.css', | ||
]; | ||
public array $depends = [DatePickerAsset::class]; | ||
} |
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,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yii\DatePicker\Asset\Npm\Dev; | ||
|
||
use Yiisoft\Assets\AssetBundle; | ||
use Yiisoft\Files\PathMatcher\PathMatcher; | ||
|
||
final class DatePickerAsset extends AssetBundle | ||
{ | ||
public string|null $basePath = '@assets'; | ||
public string|null $baseUrl = '@assetsUrl'; | ||
public string|null $sourcePath = '@npm/vanillajs-datepicker/dist'; | ||
public array $js = ['js/datepicker-full.js']; | ||
|
||
public function __construct() | ||
{ | ||
$pathMatcher = new PathMatcher(); | ||
|
||
$this->publishOptions = [ | ||
'filter' => $pathMatcher->only( | ||
'**/js/datepicker-full.js', | ||
), | ||
]; | ||
} | ||
} |
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,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yii\DatePicker\Asset\Npm\Dev; | ||
|
||
use Yiisoft\Assets\AssetBundle; | ||
use Yiisoft\Files\PathMatcher\PathMatcher; | ||
|
||
final class DatePickerBootstrap5Asset extends AssetBundle | ||
{ | ||
public string|null $basePath = '@assets'; | ||
public string|null $baseUrl = '@assetsUrl'; | ||
public string|null $sourcePath = '@npm/vanillajs-datepicker'; | ||
public array $css = ['dist/css/datepicker-bs5.css']; | ||
public array $depends = [DatePickerAsset::class]; | ||
|
||
public function __construct() | ||
{ | ||
$pathMatcher = new PathMatcher(); | ||
|
||
$this->publishOptions = [ | ||
'filter' => $pathMatcher->only( | ||
'**/dist/css/datepicker-bs5.css', | ||
), | ||
]; | ||
} | ||
} |
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,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yii\DatePicker\Asset\Npm\Dev; | ||
|
||
use Yiisoft\Assets\AssetBundle; | ||
use Yiisoft\Files\PathMatcher\PathMatcher; | ||
|
||
final class DatePickerBulmaAsset extends AssetBundle | ||
{ | ||
public string|null $basePath = '@assets'; | ||
public string|null $baseUrl = '@assetsUrl'; | ||
public string|null $sourcePath = '@npm/vanillajs-datepicker'; | ||
public array $css = ['dist/css/datepicker-bulma.css']; | ||
public array $depends = [DatePickerAsset::class]; | ||
|
||
public function __construct() | ||
{ | ||
$pathMatcher = new PathMatcher(); | ||
|
||
$this->publishOptions = [ | ||
'filter' => $pathMatcher->only( | ||
'**/dist/css/datepicker-bulma.css', | ||
), | ||
]; | ||
} | ||
} |
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,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yii\DatePicker\Asset\Npm\Dev; | ||
|
||
use Yiisoft\Assets\AssetBundle; | ||
use Yiisoft\Files\PathMatcher\PathMatcher; | ||
|
||
final class DatePickerFoundationAsset extends AssetBundle | ||
{ | ||
public string|null $basePath = '@assets'; | ||
public string|null $baseUrl = '@assetsUrl'; | ||
public string|null $sourcePath = '@npm/vanillajs-datepicker'; | ||
public array $css = ['dist/css/datepicker-foundation.css']; | ||
public array $depends = [DatePickerAsset::class]; | ||
|
||
public function __construct() | ||
{ | ||
$pathMatcher = new PathMatcher(); | ||
|
||
$this->publishOptions = [ | ||
'filter' => $pathMatcher->only( | ||
'**/dist/css/datepicker-foundation.css', | ||
), | ||
]; | ||
} | ||
} |
Oops, something went wrong.