laravel-mix-clean-css
Version:
Extension for Laravel Mix that provides clean-css support.
49 lines (37 loc) • 1.63 kB
Markdown
[](https://npmjs.com/package/laravel-mix-clean-css)
[](https://www.npmjs.com/package/laravel-mix-clean-css)
[](LICENSE)
This extension adds support for [clean-css](https://github.com/jakubpawlowicz/clean-css) to [Laravel Mix](https://github.com/JeffreyWay/laravel-mix) by using the [clean-css-loader](https://github.com/retyui/clean-css-loader).
```
npm i -D laravel-mix-clean-css
```
Require the extension inside your ``webpack.mix.js`` and add clean-css configurations like this:
```javascript
const mix = require('laravel-mix');
require('laravel-mix-clean-css');
mix
.sass('src/app.scss', 'dist')
.sass('src/app.sass', 'dist')
.less('src/app.less', 'dist')
.stylus('src/app.styl', 'dist')
// Run clean-css on all stylesheets
.cleanCss({
level: 2,
format: mix.inProduction() ? false : 'beautify' // Beautify only in dev mode
})
// Run clean-css only on one specific stylesheet
.cleanCss({
// ...
}, 'src/app.scss')
// Run clean-css only on multiple specific stylesheets
.cleanCss({
// ...
}, [
'src/app.scss',
'src/app.sass',
])
```
For more information about clean-css configurations please refer to their [documentation](https://github.com/jakubpawlowicz/clean-css/blob/master/README.md).