You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-13
Original file line number
Diff line number
Diff line change
@@ -2,22 +2,32 @@
2
2
3
3
Only load the CSS you need for the initial viewport in Rails!
4
4
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.
6
6
7
7
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.
8
8
9
9
This gem uses [Penthouse](https://github.com/pocketjoso/penthouse) to generate the critical CSS.
10
10
11
-
## Upgrading to the Latest Release
11
+
## Dependency Requirements for / Upgrading to the Latest Release
12
12
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)
14
24
15
25
## Installation
16
26
17
-
Add`critical-path-css-rails` to your Gemfile:
27
+
After reviewing the dependency requirements, add`critical-path-css-rails` to your Gemfile:
18
28
19
29
```
20
-
gem 'critical-path-css-rails', '~> 1.0.1'
30
+
gem 'critical-path-css-rails', '~> 2.3.0'
21
31
```
22
32
23
33
Download and install by running:
@@ -110,9 +120,6 @@ Careful use of these methods allows the developer to generate critical path CSS
110
120
111
121
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.
112
122
113
-
## Upgrading from version 0.X.X to 1.0.0
114
-
To maintain the latest version of Penthouse, this gem now depends on NodeJS and NVM to be installed on the system.
115
-
116
123
## Upgrading from a version earlier than 0.3.0
117
124
118
125
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
124
131
rails generate critical_path_css:install
125
132
```
126
133
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 recommended nor necessary.
128
135
129
136
130
-
## Testing
137
+
## Testing / Development
131
138
132
139
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.
133
140
@@ -152,8 +159,6 @@ major version bump = major-level updates to critical-path-css-rails, Penthouse,
152
159
153
160
## Contributing
154
161
155
-
Feel free to open an issue ticket if you find something that could be improved. A couple notes:
156
-
157
-
* If the Penthouse.js script is outdated (i.e. maybe a new version of Penthouse.js was released yesterday), feel free to open an issue and prod us to get that thing updated. However, for security reasons, we won't be accepting pull requests with updated Penthouse.js script.
162
+
Feel free to open an issue ticket if you find something that could be improved.
158
163
159
164
Copyright Mudbug Media and Michael Misshore, released under the MIT License.
0 commit comments