diff --git a/app/scss/_print.scss b/app/scss/_print.scss new file mode 100644 index 00000000..1f7cfffc --- /dev/null +++ b/app/scss/_print.scss @@ -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; + } +} diff --git a/app/scss/_settings.scss b/app/scss/_settings.scss index dbece14a..edbce433 100644 --- a/app/scss/_settings.scss +++ b/app/scss/_settings.scss @@ -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; diff --git a/app/scss/main.scss b/app/scss/main.scss index 2f7f26ab..92c383a8 100644 --- a/app/scss/main.scss +++ b/app/scss/main.scss @@ -32,3 +32,6 @@ $fa-font-path: '~font-awesome/fonts'; @import 'components/footer'; @import 'components/sync'; @import 'components/message_box'; + +// Misc +@import 'print'; diff --git a/app/scss/print.scss b/app/scss/print.scss deleted file mode 100644 index 351edb3a..00000000 --- a/app/scss/print.scss +++ /dev/null @@ -1,56 +0,0 @@ -/* -- Monod print styles -- */ - -@page { - size: A4; - margin: 2cm 1cm !important; - - @top-left { - padding-top: 1cm; - content: "Monod - The Markdown Editor by TailorDev"; - } - - @bottom-right { - padding-top: 0; - content: "Page " counter(page) "/" counter(pages); - } -} - -// 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, -div.markdown, -div.vertical-handler, -footer.main { - display: none; -} - -// Force preview max width/height -.editor { - height: 100% !important; - - .preview { - width: 100% !important; - - p { - font-size: 1rem !important; - } - } -} diff --git a/lib/webpack-template.ejs b/lib/webpack-template.ejs index e1188f7d..ae853000 100644 --- a/lib/webpack-template.ejs +++ b/lib/webpack-template.ejs @@ -10,8 +10,7 @@ <% if (htmlWebpackPlugin.files.favicon) { %> <% } %> - - + <% if (htmlWebpackPlugin.options.appMountId) { %> diff --git a/webpack.config.js b/webpack.config.js index 3e54c4c3..5ec99d10 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -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(); @@ -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 //