Skip to content

xm94630/reviersion

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

静态资源版本号自动编译

Static asset revisioning by appending content hash to filenames unicorn.css (.js or .jpg or images format)unicorn-098f6bcd.css and relace the reference which in the html code

Install

$ npm i

Run:

	jade模板编译:

		gulp 或	gulp revJade

	html编译:
		gulp revHTML

Surport:

	- jade
	- html
	- js
	- css
	- images

PHP reads the manifest and provides asset names

		/**
	 	* @param  string  $filename
	 	* @return string
	 	*/

		function asset_path($filename) {
	    	$manifest_path = 'assets/rev-manifest.json';

	    	if (file_exists($manifest_path)) {
	        	$manifest = json_decode(file_get_contents($manifest_path), TRUE);
	    	} else {
	       		$manifest = [];
	    	}

	    	if (array_key_exists($filename, $manifest)) {
	        	return $manifest[$filename];
	    	}

	    	return $filename;
		}



	

About

静态资源管理,预编译

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CoffeeScript 44.3%
  • CSS 37.1%
  • HTML 18.2%
  • JavaScript 0.4%