Code Monkey home page Code Monkey logo

gutenberg's Introduction

Gutenberg

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/[email protected]" media="print">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/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 break-before will to break before and break-after to break after.

Example:

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

<p class="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>

Avoid break inside

To avoid the page to break "inside" an element, you can use the avoid-break-inside class.

Example:

<div class="avoid-break-inside">
  <img src="gutenberg.png" />

  <p>I really don't want this part to be cut</p>
</div>

Not reformat links or acronym

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

gutenberg's People

Contributors

bafs avatar binarybrain avatar malisetti avatar mikemand avatar robertmarsal avatar strarsis avatar stritti avatar stroebjo avatar tomciopp avatar tomm1996 avatar webmandesign avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gutenberg's Issues

Typo in READ.ME

In the section for page break, "Gutenberg provide to way break page, the class page-break will for to break before and page-break-after to break after." should be "Gutenberg provide two ways break page, the class page-break will for to break before and page-break-after to break after."

Clarity in page-break file names

It would be far clearer if you simply renamed the classes to page-break-before and page-break-after. No explanation needed here.

Inverse of 'no-print'

To make it easier for implementing in a legacy system a 'print-only' class would be super-useful.

Fit to page?

Is there a way to make some content fit to a page? I'm using the page-break-after class but having an issue where sometimes some of the content is too long and it rolls over onto a new page. Is there a way to shrink or cut off the content so that it doesn't create another page?

Strange width on print

@BafS thank you for your package.

Could you look at my problem?

Why is content so narrow there:

2017-12-08_05 21 23

I have two-columned page layout, col-sm-3 and col-sm-9. First contains menu and has a class no-print, on the second I've added class print-full-width which has a media print style width: 100% !important; but, no result. How can I fix this?

Editorconfig

I would like to contribute an .editorconfig file to make sure all files share the same formatting.
This would help others with contributing well-formatted changes/additions.
Just need to know the preferences (indention, charset, whitespace handling).

Demos not working

Stylesheets on demo pages produce 404 errors. Other than that, fantastic work!

License being used?

There isn't currently a License file or license attributed with this project, could you please add one?

Fix dependency versions in releases

Hello,

it is generally considered a good idea to fix the dependencies of a public npm package to a specific version by not using any prefix in the projects' package.json. normalize-css 6.0.0 (or when depending on a package vulnerable to security threats, such as a web framework like express to the minor version normalize-css 6.0.x).

If you use the default caret (^) character in your package.json, that means that on each npm update, npm will install the latest minor release in the current project. Many package authors don't take semver too seriously, which could mean that a breaking change might be released in a minor version.

So if (just an example, I never had problems with normalize) the author of normalize-css decides that it'd be fancy to set the default background color of anything in the DOM to lime in version 6.9.0, any CI-Tool would build and deploy that without asking.

Therefore, I'd like to request that little patch to the package.json

Also:
Could you please be so kind to publish gutenberg-css#3.0.1 on npm?
I'd be delighted at using the updates in a project I'm about to launch.

More information:
https://blog.nodejitsu.com/package-dependencies-done-right/
http://stackoverflow.com/questions/25432768/change-npm-default-caret-in-package-json

Webextension?

Thank you for this effort!

This would be a lovely capability to let users add to others' web pages using a webextension browser addon.

no-print

The no-print class has no effect on my components. I am using react instead of html for my components

Remove embedded normalize

Instead of embedding normalize gutenberg should probably say it's required in the documentation then users could use a newer version of normalize

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.