Skip to content
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

Process CSS content before erasing file for writing #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

caleb531
Copy link

@caleb531 caleb531 commented Jul 30, 2016

Hi,

I am using this plugin for my Jekyll-based personal site, and it works well for the most part. However, I've noticed a "flash of unstyled content" on my site when I reload the page before my Jekyll build finishes (which happens quite often, since this plugin seems to lengthen my build time substantially, and it's more difficult for me to intuitively guess when my build is done).

Fortunately, I found the cause of the issue by examining your source code. Recall that opening a file in 'w' mode initially erases the file. In this case, the file was being prefixed after the file was opened, meaning that the file would be empty for as long as the AutoprefixerRails.process function would take to execute. This also implies that if the AutoprefixerRails.process function raises an exception, then the file will remain empty.

As you can see, I have submitted in this PR the simple fix (which involves processing the file before opening it for writing). @imathis, please consider merging this in and drafting new release.

Thanks,
Caleb

This should eliminate the "flash of unstyled content" when
compiling Jekyll sites that use this plugin.
@caleb531
Copy link
Author

@imathis any update on getting this merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant