Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiandedeyne committed Aug 22, 2018
1 parent 993a5e1 commit 9dc12f8
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,12 @@ For all configuration options, refer to the [purgecss](https://github.com/FullHu
| `enabled` | Boolean | `true` in production | Determines whether css should be purged or not |
| `globs` | Array | Matches all php files in `app/` and all files with extensions in the `extensions` option in `resources/` | Determines which files should be scanned for selectors |
| `folders` | Array| resources | Determines which folders should be scanned for selectors |
| `extensions` | Array| html, js, jsx, ts, tsx, php, vue | Determines which file types should be scanned for selectors |

Note that if you override `extensions`, the defaults will be lost! Your custom globs are merged with the default globs. If you need to fully replace the globs, use the underlying `paths` option instead.
| `extensions` | Array| html, js, jsx, ts, tsx, php, vue | Determines which file types should be scanned for selectors. If you override `extensions`, the defaults will be lost. |

### Example custom configuration

```js
let mix = require('laravel-mix');
const glob = require('glob-all');

require('laravel-mix-purgecss');

Expand All @@ -91,11 +88,11 @@ mix
.purgeCss({
enabled: true,

// Your custom globs are merged with the default globs. If you need to fully replace
// the globs, use the underlying `paths` option instead.
paths: () => glob.sync([
// Your custom globs are merged with the default globs. If you need to
// fully replace the globs, use the underlying `paths` option instead.
globs: () => [
path.join(__dirname, 'node_modules/simplemde/**/*.js'),
]),
],

extensions: ['html', 'js', 'php', 'vue'],

Expand All @@ -106,6 +103,29 @@ mix
});
```

### Overriding globs

Your custom globs are merged with the default globs. If you need to fully replace the globs, use the underlying `paths` option instead.

```js
let mix = require('laravel-mix');
const glob = require('glob-all');

require('laravel-mix-purgecss');

mix
.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css')

.purgeCss({
// Will *only* look for views and simplemde classes
paths: () => glob.sync([
path.join(__dirname, 'resources/**/*.blade.php'),
path.join(__dirname, 'node_modules/simplemde/**/*.js'),
]),
});
```

### Usage outside of Laravel

Using Laravel Mix outside of a Laravel project? We've got you covered! Everything still works, but you might want to update the folders that are being scanned for selectors.
Expand Down

0 comments on commit 9dc12f8

Please sign in to comment.