1.1.7 • Published 9 years ago
fis-pack v1.1.7
fis-pack
yog2/fis plugin for pack page and compatible well
Features
- Compatible with the yog2/fis
- Noninvasive pack the page js and css in one
- Can cross yog2 app
Install
npm install fis-pack -gHow to Use
Import the module
var fisPack = fis.require('pack');Set project name as a param
fis.config.set('projectName','yog');Prepare the param
var entry = {
"pkg/pio_demo.css": [
"**/demo.tpl:deps"
],
"pkg/pio_demo.js": [
"**/demo.tpl:deps"
],
"pkg/pio_test.css": [
"**/test.tpl:deps"
],
"pkg/pio_test.js": [
"**/test.tpl:deps"
]
}Use the plugin in the postpackager stage
//clone the original ret
var retClone = JSON.parse(JSON.stringify(ret));
for (var i in etrys) {
if (JSON.stringify(etrys[i]).indexOf('.css"') !== -1) {
realRet = fisPack(retClone, settings, etrys[i], opt);
} else {
realRet = fisPack(retClone, settings, etrys[i], opt, false);
}
}
//if use the other app component in yog2 project,need remove the map not in the current app
for (var key in realRet.map.res) {
if (key.indexOf(fis.get('namespace') + ':') === -1) {
delete realRet.map.res[key];
}
}
//get app map info
function getMap() {
var path = require('path');
var root = fis.project.getProjectPath();
var map = fis.file.wrap(path.join(root, fis.get('namespace') + '-map.json'));
return map;
}
var map = getMap();
//save the app map to the release dir
fs.writeFileSync('../'+fis.get('projectName')+'/' + map.release, JSON.stringify(realRet.map));The result
Pack before
Pack after
1.1.7
9 years ago
1.1.6
9 years ago
1.1.5
9 years ago
1.1.4
9 years ago
1.1.3
10 years ago
1.1.2
10 years ago
1.1.1
10 years ago
1.1.0
10 years ago
1.0.9
10 years ago
1.0.8
10 years ago
1.0.7
10 years ago
1.0.6
10 years ago
1.0.5
10 years ago
1.0.4
10 years ago
1.0.3
10 years ago
1.0.2
10 years ago
1.0.1
10 years ago
1.0.0
10 years ago