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脚手架缓存文件生成工具
- Host: GitHub
- URL: https://github.com/future-team/gfs-manifest-generator
- Owner: future-team
- License: mit
- Created: 2016-08-01T10:38:55.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-09-26T07:41:35.000Z (almost 10 years ago)
- Last Synced: 2025-02-06T16:43:33.885Z (over 1 year ago)
- Language: JavaScript
- Size: 529 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
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!
```
生成类似于下面的 `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×nap=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×nap=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` 文件中的图片等文件。