vite-plugin-laravel-blade-class-parser
TypeScript icon, indicating that this package has built-in type declarations

0.0.1-rc.3 • Public • Published

Vite Plugin - Laravel Blade Class Parser

vite-plugin-laravel-blade-class-parser is a Vite plugin that retrieves Laravel .blade.php files and extracts unique class names to pipe into a file for CI/CD pipelines to trigger front-end builds only when classes that are generated by JIT styling frameworks such as Tailwind are added.


NOTE: Dynamic classes passed via {{ $variable }} will be stripped and not parsed.


Installation

With pnpm:

pnpm i vite-plugin-laravel-blade-class-parser

with npm:

npm i vite-plugin-laravel-blade-class-parser

or with yarn:

yarn add vite-plugin-laravel-blade-class-parser

Setup with Vite

import LaravelBladeClassParser from "vite-plugin-laravel-blade-class-parser";

export default defineConfig({
	...
	plugins: [
	  LaravelBladeClassParser({
		// File path to write the class names to
		outputFilePath: './path-to-file.txt';
		// # Optional: string prefix to filter class names by
		filterPrefix: 'tw-theme-';
		// # Optional: delimiter string to use in the output file
		delimiter: ',';
	  }),
	],
});

Default Configurations

{
  /**
   *  Type: string
   *  Required: true
   */
  outputFilePath: path.resolve("blade-classes.txt"),
  /**
   *  Type: string
   *  Required: false
   */
  filterPrefix: "",
  /**
   *  Type: string
   *  Required: false
   */
  delimiter: ","
}

Package Sidebar

Install

npm i vite-plugin-laravel-blade-class-parser

Weekly Downloads

2

Version

0.0.1-rc.3

License

MIT

Unpacked Size

16.2 kB

Total Files

15

Last publish

Collaborators

  • dcodegroup-forge