承接 mountz/hypervel-vite 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mountz/hypervel-vite

最新稳定版本:0.2.0

Composer 安装命令:

composer require mountz/hypervel-vite

包简介

php package for integrating Hypervel and vite

README 文档

README

This package only been tested with tailwind and plain js.

Installation

  1. Install the package via Composer
composer require mountz/hypervel-vite
  1. Install required NPM packages
npm install @tailwindcss/vite laravel-vite-plugin tailwindcss vite

Configuration

  1. Create vite.config.js Create a vite.config.js file in your project root:
import { defineConfig } from "vite";
import laravel from "laravel-vite-plugin";
import tailwindcss from "@tailwindcss/vite";

export default defineConfig({
  plugins: [
    laravel({
      input: ["resources/css/app.css", "resources/js/app.js"],
      refresh: true,
    }),
    tailwindcss(),
  ],
  server: {
    hmr: {
      host: "localhost",
    },
    cors: true,
  },
});
  1. Update package.json Add the following to your package.json file:
json{
  "private": true,
  "type": "module",
  "scripts": {
    "build": "vite build",
    "dev": "vite"
  },
}
  1. Update 'resources/css/app.css'
@import "tailwindcss";
@source "../views";
  1. update 'resources/js/app.js'
import "../css/app.css";
  1. Create JS file Add Vite Directive to Blade Templates Add the Vite directive to your Blade layout/template file: blade
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Your App</title>
    @vite([])
  </head>
  <body>
    <!-- Your content here -->
  </body>
</html>

Directive Usage Notes

The @vite([]) directive with empty array will automatically include all assets in resources/js and resources/css. You can selectively include specific assets by passing them as arguments:

@vite(["resources/js/coba.js", "resources/js/cobacoba.js"])

This is useful when you want to load specific scripts on certain pages only, rather than loading all scripts on every page.

Development Run the Vite development server: npm run dev Production Build for production: npm run build License The MIT License (MIT). Please see License File for more information

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-15