├── .editorconfig ├── .gitattributes ├── .github ├── CODEOWNERS ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── PULL_REQUEST_TEMPLATE.md ├── SUPPORT.md ├── dependabot.yml └── workflows │ ├── dependency-review.yml │ └── linter.yml ├── .gitignore ├── .npmrc ├── .stylelintignore ├── .stylelintrc.json ├── .vscode └── extensions.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── composer.json ├── css ├── bootstrap-print.css └── bootstrap-print.min.css └── package.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # https://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | end_of_line = lf 8 | indent_size = 2 9 | indent_style = space 10 | trim_trailing_whitespace = true 11 | insert_final_newline = true 12 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # About CODEOWNERS - https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners 2 | 3 | * @coliff 4 | -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | - Using welcoming and inclusive language 12 | - Being respectful of differing viewpoints and experiences 13 | - Gracefully accepting constructive criticism 14 | - Focusing on what is best for the community 15 | - Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | - The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | - Trolling, insulting/derogatory comments, and personal or political attacks 21 | - Public or private harassment 22 | - Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | - Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team via GitHub issues. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [https://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: https://contributor-covenant.org 46 | [version]: https://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | We are happy to accept contributions from the community to improve this project. 4 | 5 | ## Contribution Guidelines 6 | 7 | - Use a [EditorConfig](https://editorconfig.org) plugin for consistent spacing and code formatting 8 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Description 4 | 5 | 6 | ## Motivation and Context 7 | 8 | 9 | 10 | ## How Has This Been Tested? 11 | 12 | 13 | 14 | 15 | ## Screenshots (if appropriate) 16 | 17 | ## Types of changes 18 | 19 | - [ ] Bug fix (non-breaking change which fixes an issue) 20 | - [ ] New feature (non-breaking change which adds functionality) 21 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) 22 | 23 | ## Checklist 24 | 25 | 26 | - [ ] My code follows the code style of this project. 27 | -------------------------------------------------------------------------------- /.github/SUPPORT.md: -------------------------------------------------------------------------------- 1 | Before posting an issue regarding a problem using this with your site please be sure that all of the below are checked: 2 | 3 | - [ ] I have [searched Open and Closed issues](https://github.com/coliff/bootstrap-print-css/issues?utf8=%E2%9C%93&q=is%3Aissue+) to check my issue has not been opened before 4 | - [ ] I have provided a screenshot and/or link to my site/page with issue 5 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: npm 4 | directory: "/" 5 | schedule: 6 | interval: monthly 7 | versioning-strategy: increase 8 | - package-ecosystem: github-actions 9 | directory: "/" 10 | schedule: 11 | interval: monthly 12 | -------------------------------------------------------------------------------- /.github/workflows/dependency-review.yml: -------------------------------------------------------------------------------- 1 | name: "Dependency Review" 2 | on: [pull_request] 3 | 4 | permissions: 5 | contents: read 6 | 7 | jobs: 8 | dependency-review: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: "Checkout Repository" 12 | uses: actions/checkout@v4 13 | 14 | - name: "Dependency Review" 15 | uses: actions/dependency-review-action@v4 16 | -------------------------------------------------------------------------------- /.github/workflows/linter.yml: -------------------------------------------------------------------------------- 1 | name: Lint Code Base 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | pull_request: 7 | branches: [main] 8 | 9 | jobs: 10 | build: 11 | permissions: 12 | contents: read # to fetch code (actions/checkout) 13 | statuses: write # to mark status of each linter run (github/super-linter/slim) 14 | name: Lint Code Base 15 | runs-on: ubuntu-latest 16 | if: ${{ github.actor != 'dependabot[bot]' }} 17 | 18 | steps: 19 | - name: Checkout Code 20 | uses: actions/checkout@v4 21 | with: 22 | fetch-depth: 0 23 | 24 | - name: Lint Code Base 25 | uses: super-linter/super-linter/slim@v7 26 | env: 27 | DEFAULT_BRANCH: main 28 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 29 | LINTER_RULES_PATH: / 30 | LOG_LEVEL: NOTICE 31 | SUPPRESS_POSSUM: true 32 | VALIDATE_ALL_CODEBASE: false 33 | VALIDATE_CHECKOV: false 34 | VALIDATE_EDITORCONFIG: false 35 | VALIDATE_MARKDOWN: false 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Folders to ignore 2 | node_modules/* 3 | 4 | # OS or Editor folders 5 | ._* 6 | .cache 7 | .DS_Store 8 | Thumbs.db 9 | 10 | # Files 11 | package-lock.json 12 | npm-debug.log 13 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock = false 2 | registry = 'https://registry.npmjs.org/' 3 | -------------------------------------------------------------------------------- /.stylelintignore: -------------------------------------------------------------------------------- 1 | *.min.css 2 | -------------------------------------------------------------------------------- /.stylelintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["stylelint-config-twbs-bootstrap"], 3 | "rules": { 4 | "declaration-no-important": null, 5 | "selector-no-qualifying-type": null 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["EditorConfig.EditorConfig", "stylelint.vscode-stylelint"] 3 | } 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # CHANGELOG 2 | 3 | ## v1.0.1 4 | 5 | - Remove unneeded thead rule 6 | - Remove `.navbar` display: none rule. Instead users can add `.d-print-none` class to navbar if desired. 7 | 8 | ## v1.0.0 9 | 10 | - Initial Release 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Christian Oliff 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![LICENSE](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://raw.githubusercontent.com/coliff/bootstrap-print-css/master/LICENSE) 2 | [![GitHub Super-Linter](https://github.com/coliff/bootstrap-print-css/workflows/Lint%20Code%20Base/badge.svg)](https://github.com/marketplace/actions/super-linter) 3 | [![GitHub Stars](https://img.shields.io/github/stars/coliff/bootstrap-print-css.svg?label=GitHub%20stars)](https://github.com/coliff/bootstrap-print-css) 4 | [![npm Version](https://img.shields.io/npm/v/bootstrap-print-css)](https://www.npmjs.com/package/bootstrap-print-css) 5 | 6 | # Bootstrap Print CSS 🖨️ 7 | 8 | Bootstrap 5 no longer includes custom CSS for printing - with the CSS in this project you can add it back. 9 | 10 | Note: This should improve the experience when printing, but there are [bugs and inconsistencies](https://github.com/twbs/bootstrap/issues?page=2&q=is%3Aissue+sort%3Aupdated-desc+print) with the way that browsers handle printing so testing is recommended. 11 | 12 | ## Quick Start 13 | 14 | - [Download the latest release](https://github.com/coliff/bootstrap-print-css/) 15 | - Clone the repository `git clone https://github.com/coliff/bootstrap-print-css.git` 16 | - Install with [npm](https://www.npmjs.com/package/bootstrap-print-css) `npm install bootstrap-print-css` 17 | - Install with [Yarn](https://yarnpkg.com/package/bootstrap-print-css) `yarn add bootstrap-print-css` 18 | - Install with [Composer](https://packagist.org/packages/coliff/bootstrap-print-css) `composer require coliff/bootstrap-print-css` 19 | 20 | ## Usage 21 | 22 | You can include the CSS with one of the following: 23 | 24 | 1. Import the `bootstrap-print.css` to your main CSS. This will mean one less HTTP request compared to loading it separately. 25 | 26 | 2. Load it as a separate CSS file `` 27 | 28 | ## Credits & Thanks 29 | 30 | All credit for the CSS work goes to the HTML5 Boilerplate and Bootstrap teams. I've just copied the [Bootstrap 4 print styles](https://github.com/twbs/bootstrap/blob/v4-dev/scss/_print.scss) and packaged them up for Bootstrap 5. 31 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "coliff/bootstrap-print-css", 3 | "description": "Bootstrap 5 Print Stylesheet", 4 | "license": "MIT", 5 | "homepage": "https://github.com/coliff/bootstrap-print-css#readme", 6 | "authors": [ 7 | { 8 | "name": "Christian Oliff", 9 | "homepage": "https://christianoliff.com", 10 | "role": "Developer" 11 | } 12 | ], 13 | "support": { 14 | "issues": "https://github.com/coliff/bootstrap-print-css/issues", 15 | "docs": "https://github.com/coliff/bootstrap-print-css#readme" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /css/bootstrap-print.css: -------------------------------------------------------------------------------- 1 | @media print { 2 | *, 3 | *::before, 4 | *::after { 5 | text-shadow: none !important; 6 | box-shadow: none !important; 7 | } 8 | a:not(.btn) { 9 | text-decoration: underline; 10 | } 11 | abbr[title]::after { 12 | content: " (" attr(title) ")"; 13 | } 14 | pre { 15 | white-space: pre-wrap !important; 16 | } 17 | pre, 18 | blockquote { 19 | border: 1px solid #adb5bd; 20 | page-break-inside: avoid; 21 | } 22 | tr, 23 | img { 24 | page-break-inside: avoid; 25 | } 26 | p, 27 | h2, 28 | h3 { 29 | orphans: 3; 30 | widows: 3; 31 | } 32 | h2, 33 | h3 { 34 | page-break-after: avoid; 35 | } 36 | @page { 37 | size: a3; 38 | } 39 | body { 40 | min-width: 992px !important; 41 | } 42 | .container { 43 | min-width: 992px !important; 44 | } 45 | .badge { 46 | border: 1px solid #000; 47 | } 48 | .table { 49 | border-collapse: collapse !important; 50 | } 51 | .table td, 52 | .table th { 53 | background-color: #fff !important; 54 | } 55 | .table-bordered th, 56 | .table-bordered td { 57 | border: 1px solid #dee2e6 !important; 58 | } 59 | .table-dark { 60 | color: inherit; 61 | } 62 | .table-dark th, 63 | .table-dark td, 64 | .table-dark thead th, 65 | .table-dark tbody + tbody { 66 | border-color: #dee2e6; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /css/bootstrap-print.min.css: -------------------------------------------------------------------------------- 1 | @media print{*,::after,::before{text-shadow:none!important;box-shadow:none!important}a:not(.btn){text-decoration:underline}abbr[title]::after{content:" (" attr(title) ")"}pre{white-space:pre-wrap!important}blockquote,pre{border:1px solid #adb5bd;page-break-inside:avoid}img,tr{page-break-inside:avoid}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}@page{size:a3}body{min-width:992px!important}.container{min-width:992px!important}.badge{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered td,.table-bordered th{border:1px solid #dee2e6!important}.table-dark{color:inherit}.table-dark tbody+tbody,.table-dark td,.table-dark th,.table-dark thead th{border-color:#dee2e6}} -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bootstrap-print-css", 3 | "version": "1.0.1", 4 | "description": "Print Stylesheet for Bootstrap 5", 5 | "keywords": [ 6 | "bootstrap", 7 | "print", 8 | "stylesheet" 9 | ], 10 | "homepage": "https://github.com/coliff/bootstrap-print-css", 11 | "bugs": { 12 | "url": "https://github.com/coliff/bootstrap-print-css/issues" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/coliff/bootstrap-print-css.git" 17 | }, 18 | "license": "MIT", 19 | "files": [ 20 | "css/*", 21 | "LICENSE", 22 | "package.json", 23 | "README.md" 24 | ], 25 | "author": "Christian Oliff (https://christianoliff.com)", 26 | "scripts": { 27 | "css": "npm run css-lint && npm run css-minify", 28 | "css-lint": "stylelint \"css/bootstrap-print.css\" -f verbose --fix", 29 | "css-minify": "cleancss -O1 --format breakWith=lf --output css/bootstrap-print.min.css css/bootstrap-print.css", 30 | "test": "npm run css-lint" 31 | }, 32 | "devDependencies": { 33 | "clean-css-cli": "5.6.3", 34 | "stylelint": "16.6.1", 35 | "stylelint-config-twbs-bootstrap": "14.2.0" 36 | } 37 | } 38 | --------------------------------------------------------------------------------