1.0.1 • Published 6 years ago

feather2-postpackager-offline v1.0.1

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

feather2-postpackager-offline

feather2的资源离线方案,可以用于app下的离线html等hybrid应用。

使用

npm install feather2-postpackager-offline
//conf.js
feather.config.get('postpackager').push('offline');

本地预览,注:本地预览时,url仍为localhost,可方便使用本地的一些数据mock

feather2 release

正式编译时,则需要将static和view的代码放在同一个目录

//conf/deploy/xxx.js 配置文件
module.exports = [
    {
        from: '/view',
        to: '../dist/',  //view和static需要同一目录
        subOnly: true
    },

    {
        from: '/static',
        to: '../dist/',  //view和static需要同一目录
        subOnly: true
    }
];
feather2 release -d xxx

注:js中引用图片时尽量不要使用uri语法,而采用inline转换为base64,原因因如果使用__uri后,js文件可能会被多个html文件引用,造成无法准确使用相对路径进行定位

var img = new Image();
img.src = __inline('./1.png'); //不要使用__uri('./1.png')
document.body.appendChild(img);