Skip to content

Commit

Permalink
Merge pull request #14 from scify/feature/improvements
Browse files Browse the repository at this point in the history
Improvements regarding the styles file, Composer lib updates
  • Loading branch information
PavlosIsaris authored Oct 18, 2023
2 parents 29a7f65 + 3ed151b commit 5aa6396
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 12 deletions.
41 changes: 36 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,15 @@ You can install the package via composer:
composer require scify/laravel-cookies-consent
```

If on Laravel 9 or newer, the assets files (style.css) will **automatically** be published

If on Laravel 8 or older, **make sure to manually publish** the styles file, by running:
**Make sure to manually publish** the styles file, by running:

```bash
php artisan vendor:publish \
--provider="SciFY\LaravelCookiesConsent\LaravelCookiesConsentServiceProvider" \
--tag="laravel-assets"
--tag="cookies-consent-assets"
```

In both cases, the assets files will be copied to `public/vendor/cookies_consent`.
By doing so, the assets files will be copied to `public/vendor/cookies_consent`.

You can then either decide to include the `public/vendor/cookies_consent/css/style.css` file to git (especially if you want
to edit it first), or add it to `.gitignore`, and make sure to also run this command on the staging/production server.
Expand Down Expand Up @@ -216,6 +214,39 @@ php artisan vendor:publish \
This will copy the `resources/views/components/laravel-cookies-consent` view file over
to `resources/views/components/vendor/cookies_consent` directory.

## Development

In order to locally run the package, you should use a local Laravel application, in which you are going to install it.

Make sure that the `composer.json` file of the Laravel app has the following entry:

```text
"require": {
"scify/laravel-cookies-consent": "@dev",
}
...
...
"repositories": [
{
"type": "path",
"url": "../path/to/laravel-cookies-consent/",
"options": {
"symlink": true
}
}
]
```

This will tell composer that the code for the package is of the `"@dev"` version and that it exists in the specified path.

Then run:
```bash
composer update scify/laravel-cookies-consent --prefer-source
```

To fetch the local package.

## Testing

This project uses [Pest](https://pestphp.com/) for testing. To execute the test suite, run:
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
},
"require-dev": {
"laravel/pint": "^1.6",
"nunomaduro/collision": "^6.0",
"nunomaduro/collision": "^7.0",
"nunomaduro/larastan": "^2.0.1",
"orchestra/testbench": "^7.0",
"pestphp/pest": "^1.21",
"pestphp/pest-plugin-laravel": "^1.1",
"orchestra/testbench": "^8.0",
"pestphp/pest": "^2.0",
"pestphp/pest-plugin-laravel": "^v2.2",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5",
"phpunit/phpunit": "^10.4",
"spatie/laravel-ray": "^1.26"
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion resources/assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
background-color: #2D2D2D;
position: fixed;
left: 25px;
z-index: 1;
z-index: 999999;
color: #FFFFFF;
-webkit-animation-name: slide_to_top;
-webkit-animation-duration: 1.5s;
Expand Down
2 changes: 1 addition & 1 deletion src/LaravelCookiesConsentServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class LaravelCookiesConsentServiceProvider extends ServiceProvider {
public function boot() {
$this->publishes([
__DIR__ . '/../resources/assets' => public_path('vendor/cookies_consent'),
], 'laravel-assets');
], 'cookies-consent-assets');

$this->publishes([
__DIR__ . '/../resources/views/components/' => resource_path('views/vendor/cookies_consent/components'),
Expand Down

0 comments on commit 5aa6396

Please sign in to comment.