ajaxray/gulp-buster-bundle 问题修复 & 功能扩展

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

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

ajaxray/gulp-buster-bundle

Composer 安装命令:

composer require ajaxray/gulp-buster-bundle

包简介

Symfony Bundle to integrate gulp-buster npm package for cache busting

README 文档

README

Build Status Coverage Status Latest Stable Version Total Downloads License SensioLabsInsight

When using gulp to manage assets of a Symfony application, this Bundle will help in cache busting with help of gulp-buster package.

Installation

Install the latest version with

$ composer require ajaxray/gulp-buster-bundle

Then enable the bundle in AppKernel -

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Ajaxray\GulpBusterBundle\GulpBusterBundle(),
    );
}

How to use

Assuming you are using gulp-buster to generate hashes for your web assets (javascript, css, images etc. static resources).

Now the next thing is using those hashes with your web assets. This bundle will make it easy by adding a Twig Filter. Here is how to use this filter in Twig views -

<link rel="stylesheet" href="{{ asset('css/example.min.css')|with_buster_hash  }}">

If a hash is found for this file, it will be appended as query string with it's url -

<link rel="stylesheet" href="/css/example.min.css?v=771191ec8571a3f46afdb78f3e7bed17">

If no hash found for this file -

<link rel="stylesheet" href="/css/example.min.css?v=no-buster-hash-found">

That's all :)

Configuration

By default, this bundle assumes the following paths -

  • busters.json (or any other name) file : %kernel.root_dir%/../busters.json
  • web dir: %kernel.root_dir%/../web
  • gulp dir (the dir of your gulpfile.js): %kernel.root_dir%/..

If any/all of the above is different for you, you can configure from your app/config/config.yml file using following keys -

gulp_buster:  
    # if you've configured it to be in web dir    
    busters_file: "%kernel.root_dir%/../web/busters.json"    
    web_dir: "%kernel.root_dir%/relative/path/to/web/dir"    
    gulp_dir: "%kernel.root_dir%/relative/path/to/dir"    

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-02-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固