elfsundae/laravel-asset-version 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

elfsundae/laravel-asset-version

Composer 安装命令:

composer require elfsundae/laravel-asset-version

包简介

Laravel static assets versioning via query string: `app.js` → `app.js?d41d8cd98f`

README 文档

README

Latest Version on Packagist Software License StyleCI

Laravel static assets versioning via query string: app.jsapp.js?d41d8cd98f.

Installation

$ composer require elfsundae/laravel-asset-version

For Lumen or earlier Laravel than v5.5, you need to register the service provider manually:

ElfSundae\Laravel\AssetVersion\AssetVersionServiceProvider::class,

Configuration

First you need to create an asset version configuration file located at config/asset-version.php , filled with assets paths. Or you may run the asset-version:update artisan command to create this file:

<?php

return [
    'css/app.css',
    'js/app.js',
    'images/foo.png',
];

Then you can run the asset-version:update command to update the asset version configuration:

$ php artisan asset-version:update

Now the configuration file might be:

<?php

return array (
  'css/app.css' => '3ede8f2085',
  'js/app.js' => '2eaf111399',
  'images/foo.png' => 'd41d8cd98f',
);

⚠️ You need to run the asset-version:update command every time you changed any asset content. You may call this command in your assets build script, e.g. Laravel Elixir:

elixir((mix) => {
    mix.sass('app.scss')
       .webpack('app.js')
       .exec('php artisan asset-version:update');
});

For Laravel Elixir, you can use laravel-elixir-asset-version NPM package to easily execute update.

Usage

You can get the versioned asset path using the asset_path() helper function:

asset_path('css/app.css');  // "/css/app.css?3ede8f2085"

<link href="{{ asset_path('js/app.js') }}" rel="stylesheet">

License

This package is open-sourced software licensed under the MIT License.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固