Skip to content

Commit

Permalink
Added laravel-mix-purgecss to minify CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
daveroverts committed Nov 7, 2021
1 parent 08a7693 commit 38df208
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 70 deletions.
6 changes: 6 additions & 0 deletions .markdownlint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"default": true,
"MD024": {
"siblings_only": true
}
}
14 changes: 7 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Added [laravel-mix-purgecss](https://github.com/spatie/laravel-mix-purgecss) to minify css.

## [v2.2.3](https://github.com/daveroverts/bmac/compare/v2.2.2b...v2.2.3) - 2021-11-06

### Added
Expand All @@ -16,24 +20,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [v2.2.2b](https://github.com/daveroverts/bmac/compare/v2.2.2a...v2.2.2b) - 2021-10-24

### Added

- Added [Laravel Sail](https://laravel.com/docs/master/sail) with `.devcontainer`

### Changed

- Fix for send test email not working (again)

## [v2.2.2a](https://github.com/daveroverts/bmac/compare/v2.2.2...v2.2.2a) - 2021-10-24

### Changed

- README.md rewritten
- Fix for send test email not working

### Changed

- Deployment package changed from ``lorisleiva/laravel-deployer`` to ``deployphp/deployer``
- This is temporary for PHP 8 support, I'll move the deployment script somewhere else later on.
- PHP 8 support
- `import_template.xlsx` now uses correct header values.

## [v2.2.2](https://github.com/daveroverts/bmac/compare/v2.2.1...v2.2.2) - 2021-10-09

### Changed
Expand Down
124 changes: 62 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,77 +41,77 @@ Before you begin, make sure you have a server with PHP (at least 7.3, 8 recommen

1. Clone the project

```bash
git clone https://github.com/daveroverts/bmac.git
```
```bash
git clone https://github.com/daveroverts/bmac.git
```

2. Go to the project directory

```bash
cd bmac
```
```bash
cd bmac
```

3. Copy `.env.example` to `.env`

```bash
cp .env.example .env
```

Open `.env`. The following must be changed:

- `APP_ENV`
- Set this to `production` when running this in a production environment.
- Set this to `local` when running this project locally to test things out.
- `APP_URL`
- Be sure to set this to the URL the project will be running. For example: ``APP_URL=https://example.org``
- If you forget, you will have issues with Vatsim Connect (or any OAuth 2 provider)
- `BUGSNAG_API_KEY`:
- BMAC uses Bugsnag by default for error monitoring.
- If you have a key, you can put this here. There won't be problems if you leave it empty.
- `DB_*`
- As required
- If you need to share a database with some other application, you can add in a prefix by setting `DB_TABLE_PREFIX=bmac_`
- If your database does not support long indexes, set `DB_LOWER_STRING_LENGTH=true`
- `QUEUE_DRIVER`
- For local, you can use `sync` with no issues
- In a production environment, I recommend you use something else, like `database` or `redis`. More info can be found [here](https://laravel.com/docs/master/queues)
- When you use `database`, the `jobs` table is already migrated, no need to do that again.
- When you use `redis`, `predis` is already in the `composer.json` file, no need to require it again.
- `MAIL_*`
- As required
- `MAIL_MAILER`: For testing, you can use something like [Mailtrap](https://mailtrap.io/) (online) or [Mailhog](https://github.com/mailhog/MailHog) (local, included with [Laravel Homestead](https://laravel.com/docs/master/homestead))
- `MAIL_FROM_ADDRESS`: This will be used as the `From` email. Don't forget to set this.
- `MAIL_FROM_NAME`: This will be used as the `From` name
- `OAUTH_*`
- See [Vatsim Connect](#vatsim-connect) if you're not sure what to do at this point.
- `SITE_*`
- Feel free to edit these. They are used all over the place.
- `BOOTSTRAP_COLOR`:
- By default, BMAC uses [Bootswatch Flatly](https://bootswatch.com/flatly/). If you wish to edit some colors, you can do so here.
```bash
cp .env.example .env
```

Open `.env`. The following must be changed:

- `APP_ENV`
- Set this to `production` when running this in a production environment.
- Set this to `local` when running this project locally to test things out.
- `APP_URL`
- Be sure to set this to the URL the project will be running. For example: ``APP_URL=https://example.org``
- If you forget, you will have issues with Vatsim Connect (or any OAuth 2 provider)
- `BUGSNAG_API_KEY`:
- BMAC uses Bugsnag by default for error monitoring.
- If you have a key, you can put this here. There won't be problems if you leave it empty.
- `DB_*`
- As required
- If you need to share a database with some other application, you can add in a prefix by setting `DB_TABLE_PREFIX=bmac_`
- If your database does not support long indexes, set `DB_LOWER_STRING_LENGTH=true`
- `QUEUE_DRIVER`
- For local, you can use `sync` with no issues
- In a production environment, I recommend you use something else, like `database` or `redis`. More info can be found [here](https://laravel.com/docs/master/queues)
- When you use `database`, the `jobs` table is already migrated, no need to do that again.
- When you use `redis`, `predis` is already in the `composer.json` file, no need to require it again.
- `MAIL_*`
- As required
- `MAIL_MAILER`: For testing, you can use something like [Mailtrap](https://mailtrap.io/) (online) or [Mailhog](https://github.com/mailhog/MailHog) (local, included with [Laravel Homestead](https://laravel.com/docs/master/homestead))
- `MAIL_FROM_ADDRESS`: This will be used as the `From` email. Don't forget to set this.
- `MAIL_FROM_NAME`: This will be used as the `From` name
- `OAUTH_*`
- See [Vatsim Connect](#vatsim-connect) if you're not sure what to do at this point.
- `SITE_*`
- Feel free to edit these. They are used all over the place.
- `BOOTSTRAP_COLOR`:
- By default, BMAC uses [Bootswatch Flatly](https://bootswatch.com/flatly/). If you wish to edit some colors, you can do so here.

4. Install dependencies

Production:

```bash
composer install --optimize-autoloader --no-dev
php artisan key:generate # Only needed for first deployment
php artisan migrate
php artisan storage:link # Only needed for first deployment
npm ci
npm run prod
```

Development:

```bash
composer install
php artisan key:generate # Only needed for first deployment
php artisan migrate
php artisan storage:link # Only needed for first deployment
npm ci
npm run dev
```
Production:

```bash
composer install --optimize-autoloader --no-dev
php artisan key:generate # Only needed for first deployment
php artisan migrate
php artisan storage:link # Only needed for first deployment
npm ci
npm run prod
```

Development:

```bash
composer install
php artisan key:generate # Only needed for first deployment
php artisan migrate
php artisan storage:link # Only needed for first deployment
npm ci
npm run dev
```

5. Open the website, and login.

Expand Down
108 changes: 108 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"jquery": "^3.6.0",
"jquery-ui": "^1.13.0",
"laravel-mix": "^6.0.37",
"laravel-mix-purgecss": "^6.0.0",
"popper.js": "^1.16.1",
"postcss": "^8.3.11",
"resolve-url-loader": "^4.0.0",
Expand Down
4 changes: 3 additions & 1 deletion webpack.mix.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
let mix = require('laravel-mix');
const mix = require('laravel-mix');
require('laravel-mix-purgecss');

/*
|--------------------------------------------------------------------------
Expand All @@ -17,6 +18,7 @@ mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css', {
additionalData: '$envColorPrimary: ' + (process.env.BOOTSTRAP_COLOR_PRIMARY || '#2C3E50') + '; $envColorSecondary: ' + (process.env.BOOTSTRAP_COLOR_SECONDARY || '#95a5a6') + '; $envColorTertiary: ' + (process.env.BOOTSTRAP_COLOR_TERTIARY || '#18BC9C') + '; $envColorSuccess: ' + (process.env.BOOTSTRAP_COLOR_SUCCESS || '#18BC9C') + '; $envColorWarning: ' + (process.env.BOOTSTRAP_COLOR_WARNING || '#F39C12') + '; $envColorDanger: ' + (process.env.BOOTSTRAP_COLOR_DANGER || '#E74C3C') + ';'
})
.purgeCss()
.copyDirectory('node_modules/tinymce/icons', 'public/js/icons')
.copyDirectory('node_modules/tinymce/themes', 'public/js/themes')
.copyDirectory('node_modules/tinymce/skins', 'public/js/skins')
Expand Down

0 comments on commit 38df208

Please sign in to comment.