Laravel Framework integration

Laravel uses internally its own integration of Webpack. Thanks to that the Stylif integration and configuration is similar to the Webpack configuration.

Integration example for the Laravel framework can be found in integrations examples repository .

How to integrate the Stylify into the Laravel Framework

First install the @stylify/unplugin package using NPM or Yarn:

npm i -D @stylify/unplugin
yarn add -D @stylify/unplugin

Next add Stylify plugin into the webpack.mix.js:

const { webpackPlugin } = require('@stylify/unplugin');

// ...

const mode = 'development';
const stylifyPlugin = webpackPlugin({
    transformIncludeFilter: (id) => id.endsWith('php'),
    bundles: [{
        outputFile: './resources/css/homepage.css',
        files: ['./resources/views/welcome.blade.php']
    }]
});

mix
    // ...
    .webpackConfig({
        mode: mode,
        plugins: [stylifyPlugin]
    })
    // ...

Now you can use the commands for laravel mix.

Where to go next?