Skip to content

Commit b7382cf

Browse files
Update documentation and Dockerfile to reflect necessary packages needed for Penthouse
1 parent 60a6f9d commit b7382cf

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

README.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,29 @@
22

33
Only load the CSS you need for the initial viewport in Rails!
44

5-
This gem give you the ability to load only the CSS you *need* on an initial page view. This gives you blazin' fast rending as there's no initial network call to grab your application's CSS.
5+
This gem gives you the ability to load only the CSS you *need* on an initial page view. This gives you blazin' fast rending as there's no initial network call to grab your application's CSS.
66

77
This gem assumes that you'll load the rest of the CSS asyncronously. At the moment, the suggested way is to use the [loadcss-rails](https://github.com/michael-misshore/loadcss-rails) gem.
88

99
This gem uses [Penthouse](https://github.com/pocketjoso/penthouse) to generate the critical CSS.
1010

11-
## Upgrading to the Latest Release
11+
## Dependency Requirements for / Upgrading to the Latest Release
1212

13-
Upgrade instructions from each version are included below.
13+
### For 1.0.0 or later
14+
To maintain the latest version of Penthouse, this gem depends on NodeJS and NVM to be installed on the system.
15+
16+
### For 2.0.0 or later
17+
This gem may require additional packages to be installed to run Chrome headless. Per the Penthouse documentation, this may be all you need:
18+
19+
```
20+
sudo apt-get install libnss3
21+
```
22+
23+
However, more packages may need to be installed depending on your OS distribution which can be found via [this answer](https://github.com/GoogleChrome/puppeteer/issues/404#issuecomment-323555784)
1424

1525
## Installation
1626

17-
Add `critical-path-css-rails` to your Gemfile:
27+
After reviewing the dependency requirements, add `critical-path-css-rails` to your Gemfile:
1828

1929
```
2030
gem 'critical-path-css-rails', '~> 2.3.0'
@@ -110,9 +120,6 @@ Careful use of these methods allows the developer to generate critical path CSS
110120

111121
A user can use these methods to [dynamically generate critical path CSS](https://gist.github.com/taranda/1597e97ccf24c978b59aef9249666c77) without using the `rake critical_path_css:generate` rake task and without hardcoding the application's routes into `config/critical_path_css.yml`. See [this Gist](https://gist.github.com/taranda/1597e97ccf24c978b59aef9249666c77) for an example of such an implementation.
112122

113-
## Upgrading from version 0.X.X to 1.0.0 or later
114-
To maintain the latest version of Penthouse, this gem now depends on NodeJS and NVM to be installed on the system.
115-
116123
## Upgrading from a version earlier than 0.3.0
117124

118125
The latest version of Critcal Path CSS Rails changes the functionality of the `generate` method. In past versions,
@@ -124,10 +131,10 @@ Developers upgrading from versions prior to 0.3.0 will need to replace `Critical
124131
rails generate critical_path_css:install
125132
```
126133

127-
Answer 'Y' when prompted to overwrite `critical_path_css.rake`. However, overwriting `critical_path_css.yml` is not necessary and not recommended.
134+
Answer 'Y' when prompted to overwrite `critical_path_css.rake`. However, overwriting `critical_path_css.yml` is not recommend nor necessary.
128135

129136

130-
## Testing
137+
## Testing / Development
131138

132139
This gem is to be tested inside of docker/docker-compose. [Combustion](https://github.com/pat/combustion), alongside rspec-rails and capybara, are the primary components for testing. To run the test, you'll need to have [Docker](https://docs.docker.com/engine/installation) installed. Once installed, run the following commands in the gem's root to build, run, and shell into the docker container.
133140

docker/ruby/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ FROM ruby:2.5.0
44
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
55
RUN apt-get update && apt-get install -y build-essential libpq-dev nodejs npm
66

7+
# Install Penthouse JS Dependencies
8+
RUN apt-get install -y libpangocairo-1.0-0 libx11-xcb1 libxcomposite1 libxcursor1 libxdamage1 libxi6 libxtst6 libnss3 libcups2 libxss1 libxrandr2 libgconf2-4 libasound2 libatk1.0-0 libgtk-3-0
9+
710
RUN npm cache clean -f
811
RUN npm install -g n
912
RUN n 8.9.3

0 commit comments

Comments
 (0)