Skip to content

Generate the critical CSS automatically after precompiling assets. #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2015-10-03 13:56:01 -0500 using RuboCop version 0.34.1.
# on 2015-10-20 18:42:42 -0500 using RuboCop version 0.34.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 2
# Offense count: 3
# Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength:
Max: 86
Max: 91
2 changes: 1 addition & 1 deletion BACKLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
## Features
- 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)
- Improve installation process, if necessary
- Improve manual processes, if possible (i.e having to run the rake task to generate the the critical CSS)
- Improve manual processes, if possible (i.e having to run the rake task to generate the critical CSS)
- Improve implementation. Is their a better solution then using Rails.cache?
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ First, you'll need to configue a few things in the YAML file: `config/critical_p

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.

If your main CSS file does not already exist, and you are using the Asset Pipeline, generate the main CSS file.
If you are using the Asset Pipeline, precompiling the assets will generate the critical CSS after the assets are precompiled.
```
rake assets:precompile
```
Generate the critical path CSS:
Else you can generate the critical CSS manually using the below task:
```
rake critical_path_css:generate
```
Expand Down
2 changes: 1 addition & 1 deletion lib/critical_path_css/rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module CriticalPathCSS
module Rails
VERSION = '0.2.0'
VERSION = '0.2.1'
PENTHOUSE_VERSION = '0.3.4'
end
end
2 changes: 2 additions & 0 deletions lib/tasks/critical_path_css.rake
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ namespace :critical_path_css do
CriticalPathCss.generate
end
end

Rake::Task['assets:precompile'].enhance { Rake::Task['critical_path_css:generate'].invoke }