hosmelq/laravel-elixir-uncss

Uncss with laravel files?

Closed this issue · 7 comments

Hey

Thanks for sharing this package - saves me doing it myself! :)

I just wanted to ask - how are you using this with a laravel site? Are you pointing the html to the blade cache files?

Ive tried pointing uncss to the resources/view dir but it misses loads of styles and messes up the css file.

How are you making this work?

Thanks again!!
Lee

I'm using Laravel homestead for development, and the mix below worked for me:

mix.uncss('../../../public/css/home.css', { /* Since I use sass, the default path doesn't work for me */
  html: ['http://your.app/']
},'public/css-trim');

To add another page, simply create a new mix with the parameters modified accordingly.

Sorry for too late, i'm so busy right now. This is how i used in a laravel site.

mix.uncss('files.css', {
  html: ['http://app.dev']
});

Also you can add a third parameter for the output like @blackfyre's example and a fourth parameter to specify de baseDir

I'll close this. Feel free to discuss it.

Hey, great feature! How to set this up for Laravel Mix?

Mix doesn't have any plugin ecosystem. You can use mix.webpackConfig to add any custom functionality and use something like https://github.com/vseventer/uncss-webpack-plugin.

Thanks man @hosmelq