fis-postpackager-baike-pagecache
v1.0.2
Published
A fis plugin to analyze template resource dependency, and generate hash keys for page cache.
Downloads
2
Readme
fis-prepackager-baike-pagecache
This plugin is used by Baidu Baike to analyze template dependencies which are referenced by templates (**.tpl), and generate a dependency list file for hashing and page caching.
It is highly recommended to use this plugin along with fis-postprocessor-require-async
, which can analyse async dependencies of files.
Installation
npm install -g fis-postpackager-baike-pagecache
And optionally,
npm install -g fis-postprocessor-require-async
Usage
In fis-conf.js, add
fis.config.set('modules.postpackager', 'baike-pagecache');
fis.config.set('modules.postprocessor', {
js: 'require-async',
tpl: 'require-async',
});
Configuration
There are some more settings which you can manipulate:
smartyLd
: Left delimiter of smarty. Defaults to '{%'.smartyRd
: Right delimiter of smarty. Defaults to '%}'.verbose
: Add more information in outputted file, including dependency file list and hash list. Defaults to false.include
: Manually added file dependency map. Defaults to an empty map.printExternalNamespace
: Print namespaces used by this project to fis log. Defaults to true.
Below is an example of custom configuration:
fis.config.set('settings.postpackager.baike-pagecache', {
smartyLd: '{',
smartyRd: '}',
include: {
'page/foo/*.tpl': 'widget/foo/**.tpl',
'page/bar/*.tpl': 'widget/bar/**.tpl'
}
});