famanoder / dps Goto Github PK
View Code? Open in Web Editor NEW:tangerine: a way to make skeleton screen, 一种自动生成网页骨架屏的方式
:tangerine: a way to make skeleton screen, 一种自动生成网页骨架屏的方式
dps init后一直报Cannot find module 'puppeteer',安装了puppeteer也没用
请问一下,有很多页面需要登录之后才能正常预览和生成骨架屏,这里你们是如何来解决的呢?
配置 setExtraHTTPHeaders 吗
还是用puppeteer的setCookie来处理?
你好, 请问多个页面应该怎么配置呢?
url不支持配置数组?
有些节点带有border-radius怎么处理呢
配置
const dpsConfig = {
url: 'https://baidu.com', // 待生成骨架屏页面的地址,用百度(https://baidu.com)试试也可以
output: {
filepath: '/Users/w/work/example/index1.html', // 生成骨架屏的存放页面,一般为项目的入口页面
injectSelector: '#app' // 生成的骨架屏插入页面的节点
},
background: '#eee',
animation: 'opacity 1s linear infinite;'
}
module.exports = dpsConfig;
dps -v 1.0.8
dps start
skeleton screen has created and output to /Users/w/work/example/index1.html
/Users/w/work/example/index1.html 内容
<html><head></head><body></body></html>
mac环境
安装了此包,执行dps init
显示 env: node\r: No such file or directory
无法执行
骨架屏消失到真正数据显示之间,存在短暂白屏,有什么思路解决吗
生成的html就是这样的
我的配置
const dpsConfig = {
url: 'https://baidu.com', // 待生成骨架屏页面的地址,用百度(https://baidu.com)试试也可以
output: {
filepath: '/Users/luoxue/Desktop/cli/index.html', // 生成骨架屏的存放页面,一般为项目的入口页面
injectSelector: '#wrapper' // 生成的骨架屏插入页面的节点
},
background: '#eee',
animation: 'opacity 1s linear infinite;',
includeElement: function(node, draw) {
// 定制某个节点画出来的样子,带上return false
// if(node.id == 'ui-alert') {
// 跳过该节点及其子节点
// return false;
// }
// if(node.tagName.toLowerCase() === 'img') {
// 对该图片生成宽100%,高8%,颜色为红色的色块
// draw({
// width: 100,
// height: 8,
// left: 0,
// top: 0,
// zIndex: 99999999,
// background: 'red'
// });
// return false;
// }
},
writePageStructure: function(html) {
// 自己处理生成的骨架屏
// fs.writeFileSync(filepath, html);
// console.log(html)
},
init: function() {
// 生成骨架屏之前的操作,比如删除干扰节点
}
}
module.exports = dpsConfig;
单页能不能生成加载数据后的骨架屏?
全局安装 draw-page-structure 后,以 baidu.com 为例,运行 dps start,卡在“启动浏览器...”处就不动了
我配置了 ppteer.launch({}) 的相关参数,但是好像并没有效果。麻烦指导一下~
安装插件后 使用 dps init 就报这个错误
我在windows系统下用不了,配置如下:
const dpsConfig = {
url: 'https://baidu.com', // 待生成骨架屏页面的地址,用百度(https://baidu.com)试试也可以
output: {
filepath: 'E:\code\_test\dps-test\index.html', // 生成骨架屏的存放页面,一般为项目的入口页面
injectSelector: '#app' // 生成的骨架屏插入页面的节点
},
background: '#eee',
animation: 'opacity 1s linear infinite;',
}
module.exports = dpsConfig;
报错如下:
[dps]: [output.filepath] should be a file !
似乎是识别不了windows路径,怎么办?
如题,是哪里出了问题?
另:能否启动 poppeteer 后,打开一个可视化的页面?起码能看到打开的样子是否正确,要不调试无从下手
1.evalDOM,js文件中deepFindNode方法中关于绘制元素的条件判断:t < win_h - 100这个判断项会导致屏幕底部的导航栏无法正常绘制,就需要开发者在includeElement写一大段代码自行绘制,建议把这项判断改为 (t < win_h - 100 || (getArgtype($this.includeElement) === 'function' && $this.includeElement(node, drawBlock) == true)),这样就能通过在includeElement中为指定节点返回true来进行绘制了;
2.代码调试相关:在源代码中打印信息控制台不显示,建议在pp.js文件中监听无头浏览器的console事件并打印出来。
3.建议为无头浏览器追加sessionStorage,localStorage等选项。
点赞,加油!
生产的index.html文件模板在哪里改?就是原本我的index有添加了东西,生成骨架文件就替换了
详情如下:
[root@izul Node]# dps start
∙∙∙ (node:12558) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
/nvm/versions/node/v12.18.0/lib/node_modules/puppeteer/.local-chromium/linux-756035/chrome-linux/chrome: error while loading shared libraries: libXcomposite.so.1: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md
at onClose (/nvm/versions/node/v12.18.0/lib/node_modules/puppeteer/lib/launcher/BrowserRunner.js:159:20)
at Interface.<anonymous> (/nvm/versions/node/v12.18.0/lib/node_modules/puppeteer/lib/launcher/BrowserRunner.js:149:65)
at Interface.emit (events.js:327:22)
at Interface.close (readline.js:416:8)
at Socket.onend (readline.js:194:10)
at Socket.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1221:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:12558) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:12558) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
●∙∙ 启动浏览器...
∙∙● 启动浏览器...
∙●∙ 启动浏览器...^C
--unhandled-rejections=strict
(see https://nodejs生成的页面骨架图只能再 iPhone6/7/8中正常使用,其它手机不可以噢,需要怎么配置?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.