spatompong/ngcli-indexifier

1.04 2024-03-09 08:31 UTC

This package is auto-updated.

Last update: 2024-09-09 09:41:15 UTC


README

将 Angular 资产插入 Laravel Blade 模板包。

Build Status

问题

Angular CLI 构建生产命令将在 JS 和 CSS 文件中输出哈希值。这个库将帮助您使用 blade 指令 ngStylengScripts 容易地包含这些文件。

先决条件

  1. PHP 7.1

安装

  1. 运行 composer install pangpondpon/ngcli-indexifier 安装库
  2. 如果您使用的是 Laravel 5.4 或更低版本,请将服务提供者添加到您的 config/app.php 文件中的 providers 数组。
Indexifier\IndexifierServiceProvider::class,

用法

您需要在 <body> 标签之前添加 ngStyle,并在 </body> 标签之前添加 ngScripts

<!DOCTYPE html><html lang="en"><head>
    <meta charset="utf-8">
    <title>My App</title>
    <base href="/">

    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" type="image/x-icon" href="favicon.ico">
    
    @ngStyle
</head>
<body>
    <app-root></app-root>
    
    @ngScripts
</body>