laravel-mix-css-partial

1.0.1 • Public • Published

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'),
]);

Package Sidebar

Install

npm i laravel-mix-css-partial

Weekly Downloads

5

Version

1.0.1

License

MIT

Unpacked Size

6.43 kB

Total Files

4

Last publish

Collaborators

  • abhisheksatre