-
Notifications
You must be signed in to change notification settings - Fork 54
Support multiple css paths #32
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
Support multiple css paths #32
Conversation
* Ensure only one css_path configuration is used * Raise error if length of css_paths does not match routes * Add comment in config file about css_paths
ca9e9c2 to
0682adf
Compare
|
@randallreedjr Thanks for the PR! I've been taking a look at this, and I have some feedback. I'll try to post all my feedback by this weekend. One thing that I'd like to see done is the new I have a few edit suggestions for the tests (which we can always refactor later so not terribly critical), |
|
Cool, thanks @michael-misshore! I really appreciate your responsiveness. I'll get cracking on your feedback as soon as I can. |
|
@michael-misshore Friendly reminder for feedback :) |
|
@dm-randy Thanks and sorry!. @randallreedjr Your changes gave me some ideas for some refactors. I started working on this before the holiday, and I'll try to have something that can be reviewed and merged into your branch sometime soon. |
|
Oops, both of those accounts are me |
|
@michael-misshore I just pushed an update with an addition to the README. Any feedback from your end? |
|
@randallreedjr README changes look good. Did you see the review I started regarding |
|
@michael-misshore Hm, not sure what's going on, but I don't see any reviews |
| end | ||
|
|
||
| context 'when single css_path is specified' do | ||
| let(:config_file) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@randallreedjr, Is it possible to move this config into a fixture of sorts? I think it may help improve the readability and clean up this spec if we were able to write something like let(:config_file) { File.open('/path/to/single_css_path_conf.yml') } or something along those lines. Not sure if a fixture is the right call or just moving the config into a file in a config directory. Likewise, the same can be done with the other similar config variables.
Once this is address, I'll go ahead and merge this in and tag you with the merge request that has the refactors in it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@randallreedjr Can you see my above message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michael-misshore Yep, will do!
Rationale
I am currently using critical-path-css-rails to generate the critical CSS for a react on rails project using webpack to package our assets. We are using the ExtractTextPlugin to separate the CSS for each page to minimize load. We successfully deployed critical-path-css-rails for one of our pages, but cannot easily apply it to additional pages without a way to handle multiple CSS paths.
Implementation
This is the simplest implementation that occurred to me. It adds a new key,
css _paths, which is mutually exclusive from the existing keycss_path. Likeroutes,css_pathscan be a list of css files that correspond to the routes; we assume they are in the same respective order. Therefore, both arrays should be the same length.This change is backwards compatible, so existing users should not experience a breaking change.
The PR also updates the README to address #31.
Tasks
css_pathsto specify separate css path per route