如何将前端页面元素一键保存

618 阅读1分钟
原文链接: github.com

中文文档

Pull a whole element with css styles from the front page.

Usage

FeSpider provides a chrome devtool extension, namely a .crx file, and a server-side (Nodejs) script. With the extension installed, a side panel named "FeSpider" in the "Elements" panel is ready.

Just inspect the element to be pulled out, select some options, and run it.

inspect

pull

review

That's it.

Advance

If you want to save the extracted content to a local file, or analyze css file contents to extract information such as @font-face, you shall start a server. Please select the fetchFont option, then start the server locally to listen to file url fetching requests from FeSpider's Chrome Devtool extension.

Just run this command in the src directory:

node ./server.js

or this command in the project root directory:

npm start

HTTPS

Before starting the server, you may need to configure the SSL cert for the server to serve HTTPS resources. Just run this command in the src directory:

sh ./sslcert.sh

Benefit

Css styles would be optimized. Every tag has just one class name. Tags having the same styles would be the same class.

You say "the class names make no sense"? Well, nobody cares elements' class names inside a UI component, even you as a developer.

License

MIT

Copyright (c) 2017-present, shenfe