monster010/codeigniter-vite-plugin

Vite 的 CodeIgniter 插件(CodeIgniter 端)

v0.0.7 2024-03-16 19:13 UTC

This package is auto-updated.

Last update: 2024-09-16 20:14:19 UTC


README

Build Status Total Downloads Latest Stable Version License

介绍

Vite 是一个现代的前端构建工具,提供了极快的开发环境,并将您的代码打包用于生产。

此插件配置了 Vite,以便与 CodeIgniter 后端服务器一起使用。

此插件基于 Laravel Vite 插件

安装

使用 composer 安装

composer require monster010/codeigniter-vite-plugin

发布默认资源(package.json,vite.config.js,tailwind.config.js 等)

php spark vite:publish

替代方案

// vite.config.js
import { defineConfig } from 'vite';
import codeigniter from "codeigniter-vite-plugin";

export default defineConfig({
    plugins: [
        codeigniter([
            'resources/css/app.css',
            'resources/js/app.js',
        ]),
    ],
});

入门

  • 安装您的 node 依赖项: npm install
  • 启动 vite 服务器: npm run dev
  • 加载助手 helper('vite')

加载您的脚本和样式

<!doctype html>
<head>
    {{-- ... --}}

    <?= vite_tags(['resources/css/app.css', 'resources/js/app.js']) ?>
</head>

替代方案

<!doctype html>
<head>
    {{-- ... --}}

    <?= vite_tags('resources/js/app.js') ?>
</head>

许可证

CodeIgniter Vite 插件是开源软件,受 MIT 许可证 许可。