An open API service indexing awesome lists of open source software.

https://github.com/future-team/gfs-manifest-generator

generator-future-static脚手架缓存文件生成工具
https://github.com/future-team/gfs-manifest-generator

Last synced: about 2 months ago
JSON representation

generator-future-static脚手架缓存文件生成工具

Awesome Lists containing this project

README

          

# manifest-generator
为前端项目脚手架generator-future-static生成缓存文件。
关于 `manifest` 属性的介绍请参见 [Using_the_application_cache](https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache)
# Example
例如这样的 `index.html` 文件,
```html






manifest generator template


Wellcome Use Manifest Generator!



example1

qweqweqwe








```
生成类似于下面的 `index.appcache` 的缓存文件
``` .appcache
CACHE MANIFEST
# origin manifest file
# create at Wed Aug 31 2016 21:34:52 GMT+0800 (CST)
CACHE:
./index.css
./imgs/example2.jpg
./imgs/example3.jpg
./common.css
https://cdnjs.cloudflare.com/ajax/libs/normalize/4.2.0/normalize.css?hash=wertyuioityrewqytre&timesnap=46541465465469
./imgs/example1.jpg
http://115.img.pp.sohu.com/images/blog/2007/6/11/6/15/113b04b5b3c.jpg
https://code.jquery.com/jquery-2.2.4.min.js
./common.js
./index.js?hash=testjavascript&timesnap=46541465465469
http://www.dabaoku.com/sucaidatu/dongwu/dongwushijie/015203.JPG
http://img-arch.pconline.com.cn/images/upload/upc/tx/wallpaper/1304/15/c0/19877580_1366010662675.jpg
./index.html?1472650492872
NETWORK:
*
```
详细请见 [example](./example)
# Usage
```javascript
var gulp = require('gulp');
var config = {
html: "./html",
output: "./dist"
};
var manifest = require('gfs-manifest-generator');

gulp.task('css', function () {
// TODO css task
});

gulp.task('js', function () {
// TODO js task
});

gulp.task('html', function () {
return gulp.src([config.html + '/**/*.*'])
.pipe(manifest({
dir: config.output
}))
.pipe(gulp.dest(config.output));
});

gulp.task('default', ['js', 'css', 'html']);
```
# Notice
`css`, `js` 文件的预处理必须在执行 `manifest` 之前完成! 否则无法自动更新 `css` 文件中的图片等文件。