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
- Allow the user to give a single route for a Controller#Show route, instead of hard coding every unique Resource#Show URL
8
5
* Implementation should account for any route that allows variables/parameters in the URL
9
6
- Error reporting during CSS generation (404, 500 errors, etc.)
10
-
- Allow the user to pass arguments to Penthouse.js, i.e. Viewport size, etc. For a list of the configurable options, please see [Penthouse](https://github.com/pocketjoso/penthouse)
11
7
- Improve installation process, if possible
12
8
- Improve implementation. Is their a better solution then using Rails.cache?
Copy file name to clipboardExpand all lines: README.md
+33-11Lines changed: 33 additions & 11 deletions
Display the source diff
Display the rich diff
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
-
## Update
11
+
## Dependency Requirements for / Upgrading to the Latest Release
12
12
13
-
Versions below 0.3.0 are not compatible with this version. Please read the Upgrading from Previous Versions section below for more information.
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.0'
30
+
gem 'critical-path-css-rails', '~> 2.3.0'
21
31
```
22
32
23
33
Download and install by running:
@@ -110,7 +120,7 @@ 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 Previous Versions
123
+
## Upgrading from a version earlier than 0.3.0
114
124
115
125
The latest version of Critcal Path CSS Rails changes the functionality of the `generate` method. In past versions,
116
126
`generate` would produce CSS for all of the routes listed in `config/critical_path_css.yml`. This functionality has been replaced by the `generate_all` method, and `generate` will only produce CSS for one route.
@@ -121,7 +131,21 @@ Developers upgrading from versions prior to 0.3.0 will need to replace `Critical
121
131
rails generate critical_path_css:install
122
132
```
123
133
124
-
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.
135
+
136
+
137
+
## Testing / Development
138
+
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.
Once shell'd in, run `bundle exec rspec spec` to run the test. The test rails app lives in `spec/internal`, and it can be viewed locally at `http://localhost:9292/`
148
+
125
149
126
150
## Versions
127
151
@@ -135,8 +159,6 @@ major version bump = major-level updates to critical-path-css-rails, Penthouse,
135
159
136
160
## Contributing
137
161
138
-
Feel free to open an issue ticket if you find something that could be improved. A couple notes:
139
-
140
-
* 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.
141
163
142
-
Copyright Mudbug Media and Michael Misshore, released under the MIT License.
164
+
Copyright Mudbug Media and Michael Misshore, released under the MIT License.
0 commit comments