承接 aozisik/grunt-cache-buster 相关项目开发

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

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

aozisik/grunt-cache-buster

Composer 安装命令:

composer require aozisik/grunt-cache-buster

包简介

A Laravel 4 package that works with Grunt for cache busting.

README 文档

README

This is a simple cache buster for Laravel 4 framework and Grunt task manager. The package depends on grunt-cachebuster npm module (felthy/grunt-cachebuster). After you install the npm module and this package, all you have to is add a service provider and configure your Gruntfile.js. No modification in .htaccess or NGINX configuration modifications are necessary.

Configuring Grunt

First add the following module to your package.json and run npm :

"grunt-cachebuster": "^0.1.5"

Add this to your grunt.initConfig

cachebuster: {
    build: {
      options: {
          basedir: 'public/',
          format: 'php',
          banner:
              '/**\n' +
              ' * GENERATED FILE, DO NOT EDIT. This file is simply a collection of generated hashes for static assets in \n' +
              ' * the project. It is generated by grunt, see Gruntfile.js for details.\n' +
              ' */'
      },
      src: ['public/**/*'],
      dest: 'app/config/cachebuster.php'
    }
}

And then load the npm task and register it where necessary

grunt.loadNpmTasks('grunt-cachebuster');
//..
//..
grunt.registerTask('buster', ['cachebuster']);

Make sure the cache buster task runs after all the other tasks. It will generate a file in your app/config directory by default. The package depends on this config file to function properly. After you set things up properly, run grunt and make sure it generates "cachebuster.php" file properly.

Configuring Laravel

Install this package by adding the following dependency to your L4 project:

"aozisik/grunt-cache-buster": "dev-master"

After the installation, you need to add the following service provider in your app/config/app.php:

'Aozisik\GruntCacheBuster\GruntCacheBusterServiceProvider'

Then wherever you want a cache-busted asset you can use the following instead of the default asset() helper

CacheBusted::asset('js/resultsCtrl.js')

The code above, used instead of the default asset helper, will yield the following URL:

http://demo.app/js/resultsCtrl.js?v=23d85993f132d67754489e47f66cf6ac

Enjoy!

If you have any questions to ask or bugs to report, feel free to contact me...

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-04-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固