Added vite for JS/CSS assets, made some changes to ServiceProvider
This commit is contained in:
parent
972ddb9214
commit
acd26c85f6
13 changed files with 87 additions and 27 deletions
|
@ -6,11 +6,8 @@ namespace Crawl\Skeleton;
|
|||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class SkeletonServiceProvider extends ServiceProvider
|
||||
final class SkeletonServiceProvider extends ServiceProvider
|
||||
{
|
||||
public const PACKAGE_VENDOR = 'crawl';
|
||||
public const PACKAGE_NAME = 'skeleton';
|
||||
|
||||
private const COMMANDS = [
|
||||
|
||||
];
|
||||
|
@ -21,31 +18,31 @@ class SkeletonServiceProvider extends ServiceProvider
|
|||
public function boot(): void
|
||||
{
|
||||
// Optional methods to load package assets
|
||||
//$this->loadMigrationsFrom($this->getPackagePath() . '/database/migrations');
|
||||
//$this->loadRoutesFrom($this->getPackagePath() . '/routes.php');
|
||||
//$this->loadTranslationsFrom($this->getPackagePath() . '/resources/lang', self::PACKAGE_NAME);
|
||||
//$this->loadViewsFrom($this->getPackagePath() . '/resources/views', self::PACKAGE_NAME);
|
||||
//$this->loadMigrationsFrom($this->packageRoot() . '/database/migrations');
|
||||
//$this->loadRoutesFrom($this->packageRoot() . '/routes.php');
|
||||
//$this->loadTranslationsFrom($this->packageRoot() . '/resources/lang', Skeleton::PACKAGE_NAME);
|
||||
//$this->loadViewsFrom($this->packageRoot() . '/resources/views', Skeleton::PACKAGE_NAME);
|
||||
|
||||
if ($this->app->runningInConsole()) {
|
||||
// Publish config
|
||||
$this->publishes([
|
||||
$this->getPackagePath() . '/config/config.php' => config_path(self::PACKAGE_NAME . '.php'),
|
||||
], 'config');
|
||||
$this->packageRoot() . '/config/config.php' => config_path(Skeleton::PACKAGE_NAME . '.php'),
|
||||
], Skeleton::PACKAGE_NAME . '-config');
|
||||
|
||||
// Publish assets
|
||||
//$this->publishes([
|
||||
// $this->getPackagePath() . '/resources/assets' => public_path('vendor/' . self::PACKAGE_NAME),
|
||||
//], ['assets', 'public']);
|
||||
// $this->packageRoot() . '/public' => public_path('vendor/' . Skeleton::PACKAGE_NAME),
|
||||
//], Skeleton::PACKAGE_NAME . '-assets');
|
||||
|
||||
// Publishing translation files
|
||||
// Publish translation files
|
||||
//$this->publishes([
|
||||
// $this->getPackagePath() . '/resources/lang' => resource_path('lang/vendor/' . self::PACKAGE_NAME),
|
||||
//], 'lang');
|
||||
// $this->packageRoot() . '/resources/lang' => resource_path('lang/vendor/' . Skeleton::PACKAGE_NAME),
|
||||
//], Skeleton::PACKAGE_NAME . '-lang');
|
||||
|
||||
// Publishing views
|
||||
// Publish views
|
||||
//$this->publishes([
|
||||
// $this->getPackagePath() . '/resources/views' => resource_path('views/vendor/' . self::PACKAGE_NAME),
|
||||
//], 'views');
|
||||
// $this->packageRoot() . '/resources/views' => resource_path('views/vendor/' . Skeleton::PACKAGE_NAME),
|
||||
//], Skeleton::PACKAGE_NAME . '-views');
|
||||
|
||||
// Registering package commands
|
||||
$this->commands(self::COMMANDS);
|
||||
|
@ -58,15 +55,15 @@ class SkeletonServiceProvider extends ServiceProvider
|
|||
public function register(): void
|
||||
{
|
||||
// Automatically apply the package configuration
|
||||
$this->mergeConfigFrom($this->getPackagePath() . '/config/config.php', self::PACKAGE_NAME);
|
||||
$this->mergeConfigFrom($this->packageRoot() . '/config/config.php', Skeleton::PACKAGE_NAME);
|
||||
|
||||
// Register the main class to use with the facade
|
||||
$this->app->singleton(self::PACKAGE_NAME, static function () {
|
||||
$this->app->singleton(Skeleton::PACKAGE_NAME, static function () {
|
||||
return new Skeleton();
|
||||
});
|
||||
}
|
||||
|
||||
private function getPackagePath(): string
|
||||
private function packageRoot(): string
|
||||
{
|
||||
return realpath(__DIR__ . '/..');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue