optimistdigital/laravel-create-frontend

v2.0.0 2019-04-22 13:36 UTC

This package is auto-updated.

Last update: 2024-08-25 12:56:57 UTC


README

此包向Laravel添加了一个辅助方法,用于在HTML中包含来自create-frontend的js和css文件。它从asset-manifest.json中获取已版本化文件的正确路径。

使用方法

1. 安装包

composer require optimistdigital/laravel-create-frontend

2. 在HTML中添加以下内容

<script src="{{ frontend('app.js') }}"></script>

3. 对于生产环境,还要包含css

<link rel="stylesheet" type="text/css" href={{ frontend('app.css') }}>

API

/**
 * $assetName - name of the unhashed asset in your manifest
 * $manifestPath - location of your manifest - optional, defaults to public/build/asset-manifest.json
 */
frontend($assetName, $manifestPath)