Gutenberg

Modern framework to print the web correctly.

Github星跟踪图

Modern framework to print web pages correctly

npm (scoped)
Build Status
Maintainability
license
download

How to use

Simply include the right stylesheet(s) in your html and load it only for a printer.
Gutenberg.css is the base stylesheet but there are themes available in the themes folder.

Example with Gutenberg and "old style" theme :

<link rel="stylesheet" href="dist/gutenberg.css" media="print">
<link rel="stylesheet" href="dist/themes/oldstyle.css" media="print"> <!-- optional -->

comparison

Comparison between standard print (left) and Gutenberg (middle, Modern style and right, Old style)

npm

Gutenberg is available on npm

npm install gutenberg-css

(or yarn add gutenberg-css for yarn users)

CDN

You can also use the unpkg service as a CDN.

<link rel="stylesheet" href="https://unpkg.com/gutenberg-css@0.4" media="print">
<link rel="stylesheet" href="https://unpkg.com/gutenberg-css@0.4/dist/themes/oldstyle.min.css" media="print">

What does the framework do ?

Hide elements

To hide elements to be printed you can simply add the class no-print.

Force break page

Gutenberg provides two ways to break a page, the class page-break-before will to break before and page-break-after to break after.

Example:

<!-- The title will be on a new page -->
<h1 class="page-break-before">My title</h1>

<p class="page-break-after">I will break after this paragraph</p>
<!-- Break here, the next paragraph will be on a new page -->
<p>I am on a new page</p>

If you do not want to reformat the links, acronym or abbreviation to show the full url or title, you
can use the class no-reformat.

Force to print background

To force backgrounds to be printed (can be useful when you "print" a pdf), add this CSS (compatible with Safari and Chrome) :

-webkit-print-color-adjust: exact;
        print-color-adjust: exact;

Dev

  • npm i to install the dependencies
  • npm run watch to "watch" the scss folder and compile to css
  • npm run build to compile gutenberg to css

主要指标

概览
名称与所有者BafS/Gutenberg
主编程语言SCSS
编程语言JavaScript (语言数: 2)
平台
许可证MIT License
所有者活动
创建于2015-10-20 15:16:35
推送于2024-02-03 04:40:43
最后一次提交2023-02-22 23:57:29
发布数12
最新版本名称v0.7.0 (发布于 )
第一版名称v0.1.0 (发布于 )
用户参与
星数4.9k
关注者数72
派生数142
提交数78
已启用问题?
问题数18
打开的问题数6
拉请求数12
打开的拉请求数1
关闭的拉请求数9
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?