Skip to content

Commit 1876af4

Browse files
authored
Hotfix for pdf css generation (#1209)
* add missing dependencies for PDF generation * make in production only * Have another go at trying to fix the PDF's
1 parent d3da56d commit 1876af4

3 files changed

Lines changed: 3 additions & 14 deletions

File tree

app/assets/stylesheets/pdf.scss

Lines changed: 0 additions & 1 deletion
This file was deleted.

app/views/layouts/pdf.html.erb

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,8 @@
44
<html>
55
<head>
66
<title><%= yield(:title) %></title>
7-
<% css = '' %>
8-
<% candidates = [] %>
9-
<% candidates.concat(Dir.glob(Rails.root.join('app', 'assets', 'builds', '*.css').to_s)) %>
10-
<% candidates.concat(Dir.glob(Rails.root.join('public', 'assets', '*.css').to_s)) %>
11-
<% css = candidates.filter_map do |path|
12-
begin
13-
File.read(path)
14-
rescue => e
15-
Rails.logger.warn "Could not read compiled css from #{path}: #{e.message}"
16-
nil
17-
end
18-
end.join("\n") %>
7+
<% app_css_path = Rails.root.join('app', 'assets', 'builds', 'application.css') %>
8+
<% css = File.exist?(app_css_path) ? File.read(app_css_path) : '' %>
199
<style type="text/css">
2010
<%= css.html_safe %>
2111
</style>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"lint:styles:fix": "stylelint 'app/**/*.s+(a|c)ss' 'app/**/*.vue' --ignore-path .gitignore --fix",
88
"build": "webpack --config webpack.config.js",
99
"watch": "webpack --config webpack.config.js --watch",
10-
"build:css": "sass ./app/assets/stylesheets/application.scss:./app/assets/builds/application.css ./app/assets/stylesheets/pdf.scss:./app/assets/builds/pdf.css --no-source-map --load-path=node_modules",
10+
"build:css": "sass ./app/assets/stylesheets/application.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules",
1111
"update:font": "ruby bin/copy_fontawesome_fonts"
1212
},
1313
"dependencies": {

0 commit comments

Comments
 (0)