Css Partial

Laravel Mix extension for CSS Partials.
latest v1.0.1 - released
abhisheksatre
8 downloads last week
MIT license
8 versions
css
partials

Laravel Mix CSS Partials

Software License Latest Version on NPM

This package adds a cssPartial option to Laravel Mix, which copies CSS code into a partial file.

Usage

First, install the extension.

npm install laravel-mix-css-partial --save-dev

Then, require it within your webpack.mix.js file:

let mix = require('laravel-mix');

require('laravel-mix-css-partial');

mix.cssPartial('css/gallery.scss', 'partials/gallery-css.php');


Note: If you are using setPublicPath option in your mix file then declare setPublicPath option before cssPartial option.

mix.setPublicPath('dist').cssPartial('css/gallery.scss', 'partials/gallery-css.php');
Supported CSS Preprocessors:

sass less stylus postCss

Plugin Options and PostCss Plugins

For Sass, less, stylus files you may provide plugin options as the third argument and postCssPlugins as the fourth argument.

mix.cssPartial('src', 'partial_path', 'pluginOptions', 'postCssPlugins');

For the .css files you may provide postCssPlugins as the third argument.

mix.cssPartial('gallery.css', 'partials/gallery-css.php', [
    require('tailwindcss'),
]);