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
+11-9
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ This gem uses [PhantomJS](https://github.com/colszowka/phantomjs-gem) and [Penth
14
14
Add `critical-path-css-rails` to your Gemfile:
15
15
16
16
```
17
-
gem 'critical-path-css-rails', '~> 0.1.0'
17
+
gem 'critical-path-css-rails', '~> 0.2.0'
18
18
```
19
19
20
20
Download and install by running:
@@ -23,24 +23,26 @@ Download and install by running:
23
23
bundle install
24
24
```
25
25
26
-
Create the rake task that will generate your critical CSS
26
+
Run the generator to install the rake task and configuration file:
27
27
28
28
```
29
29
rails generator critical_path_css:install
30
30
```
31
31
32
-
This adds the following file:
32
+
The generator adds the following files:
33
33
34
+
*`config/critical_path_css.yml`
34
35
*`lib/tasks/critical_path_css.rake`
35
36
36
37
37
38
## Usage
38
39
39
-
First, you'll need to configue a few variables in the rake task: `lib/tasks/critical_path_css.rake`
40
+
First, you'll need to configue a few things in the YAML file: `config/critical_path_css.yml`
40
41
41
-
*`@base_url`: Change the url's here to match your Production and Development base URL, respectively.
42
-
*`@routes`: List the routes that you would like to generate the critical CSS for. (i.e. /resources, /resources/show/1, etc.)
43
-
*`@main_css_path`: Inside of the generate task, you'll need to define the path to the application's main CSS. The gem assumes your CSS lives in `RAILS_ROOT/public`. If your main CSS file is in `RAILS_ROOT/public/assets/main.css`, you would set the variable to `/assets/main.css`.
42
+
*`manifest_name`: If you're using the asset pipeline, add the manifest name.
43
+
*`css_path`: If you're not using the asset pipeline, you'll need to define the path to the application's main CSS. The gem assumes your CSS lives in `RAILS_ROOT/public`. If your main CSS file is in `RAILS_ROOT/public/assets/main.css`, you would set the variable to `/assets/main.css`.
44
+
*`routes`: List the routes that you would like to generate the critical CSS for. (i.e. /resources, /resources/show/1, etc.)
45
+
*`base_url`: Add your application's URL for the necessary environments.
44
46
45
47
46
48
Before generating the CSS, ensure that your application is running (viewable from a browser) and the main CSS file exists. Then in a separate tab, run the rake task to generate the critical CSS.
0 commit comments