Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #95 from TailorDev/fix-print
Browse files Browse the repository at this point in the history
Fix print issues
  • Loading branch information
willdurand committed Apr 11, 2016
2 parents 173df7c + 0c0740b commit e1fc8f4
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 63 deletions.
85 changes: 85 additions & 0 deletions app/scss/_print.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/* -- Monod print styles -- */
@media print {

@page {
size: 'A4';
margin: 3cm 2cm !important;
}

// Page breaks
p,
h2,
h3 {
orphans: 3;
widows: 3;
}

h2,
h3 {
page-break-after: avoid;
}

tr,
blockquote,
img {
page-break-inside: avoid;
}

// Hide unwanted elements
header.main,
form#templateForm,
div.markdown,
div.vertical-handler,
footer.main {
display: none;
}

// Force preview max width/height
.layout {
display: block !important;

.editor {
height: 100% !important;
display: block !important;

.preview {
overflow: visible;

.rendered {
padding: 0;
}
}
}
}

// Override styles
a {
border: 0 !important;
}

pre, blockquote {
border: 0;
border-left: 3px solid $silver;

& > * {
color: $emperor !important;
}
}

blockquote {
font-style: italic;
}

pre {
font-size: 10pt;

& > code {
margin: 0 !important;
background: transparent !important;
}
}

p {
font-size: 11pt !important;
}
}
2 changes: 1 addition & 1 deletion app/scss/_settings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ $header-font-family: 'LatoLatin', $common-font-family;

// Typography
$code-font-family: Consolas, 'Liberation Mono', Courier, monospace;
$code-background: transparent;
$code-border: 0;
$code-padding: 0;
$print-transparent-backgrounds: false;

// Callout
$callout-radius: 0;
Expand Down
3 changes: 3 additions & 0 deletions app/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ $fa-font-path: '~font-awesome/fonts';
@import 'components/footer';
@import 'components/sync';
@import 'components/message_box';

// Misc
@import 'print';
56 changes: 0 additions & 56 deletions app/scss/print.scss

This file was deleted.

3 changes: 1 addition & 2 deletions lib/webpack-template.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
<% if (htmlWebpackPlugin.files.favicon) { %>
<link rel="shortcut icon" href="<%= htmlWebpackPlugin.files.favicon%>">
<% } %>
<link href="<%= htmlWebpackPlugin.files.css[1] %>" rel="stylesheet" media="screen,print">
<link href="<%= htmlWebpackPlugin.files.css[0] %>" rel="stylesheet" media="print">
<link href="<%= htmlWebpackPlugin.files.css[0] %>" rel="stylesheet" media="all">
</head>
<body>
<% if (htmlWebpackPlugin.options.appMountId) { %>
Expand Down
6 changes: 2 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ const pkg = require('./package.json');
const TARGET = process.env.npm_lifecycle_event;
const PATHS = {
app: path.join(__dirname, 'app'),
build: path.join(__dirname, 'build'),
print: path.join(__dirname, 'app/scss/print.scss')
build: path.join(__dirname, 'build')
};
const VERSION = process.env.SOURCE_VERSION || process.env.SHA || childProcess.execSync('git rev-parse HEAD').toString();

Expand All @@ -28,8 +27,7 @@ process.env.BABEL_ENV = TARGET;
const common = {
// Entry points are used to define "bundles"
entry: {
app: PATHS.app,
print: PATHS.print
app: PATHS.app
},
// Extensions that should be used to resolve module
//
Expand Down

0 comments on commit e1fc8f4

Please sign in to comment.