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

Vendorize prism #131

Merged
merged 1 commit into from
Nov 14, 2019
Merged

Vendorize prism #131

merged 1 commit into from
Nov 14, 2019

Conversation

hartsick
Copy link
Contributor

@hartsick hartsick commented Nov 4, 2019

No description provided.

@hartsick hartsick temporarily deployed to cfa-styleguide-pr-131 November 4, 2019 15:45 Inactive
The prism-rails gem is sparsley updated and includes a version of prism from 2017;
prism has been updated a number of times since then.

Additionally and more importantly, it locks the rails version at "< 6", which is not
good if you're trying to upgrade to Rails 6

Vendorizing rather than using from CDN helps us avoid potential for exfiltrating cookie data if we were to (see
https://www.troyhunt.com/the-javascript-supply-chain-paradox-sri-csp-and-trust-in-third-party-libraries/).
Also allows for offline development.

also: change block languages from 'language-ruby' to 'language-erb' to make the syntax
highlighting more correct

Fixes #106

Signed-off-by: Christa Hartsock <[email protected]>
Co-authored-by: Christa Hartsock <[email protected]>
@hartsick
Copy link
Contributor Author

hartsick commented Nov 13, 2019

Closes #106

@hartsick
Copy link
Contributor Author

Copying conversation from Slack:

tgrathwell 10 days ago
i tried to use this branch and refresh the GCF /cfa/styleguide on localhost and it did not immediately color the things
i’m seeing all these <script src="/assets/prism/ in the view source indicating that the code is still coming from the gem
seems like a caching sort of thing, if I rename all the references of prism.js to prism-vendor.js it starts working. but you shouldn’t have to do that
i don’t know if there’s something like rake assets:forget_all_that that one is supposed to run to solve these problems
in the past bumping config.assets.version has helped but it didn’t seem to do anything for me here

christa 10 days ago
I can’t reproduce what you’re seeing with the caching, I think. here’s what I tried:

  1. pull master, run rails s
  2. checkout branch, rail rails s
    even without hard refresh, seems fine.
    I think the assets/prism doesn’t mean that it’s pulling from the gem, though, since we’re adding it to the asset precompilation like before. I didn’t want to add it to the master css or js files, since we only want on styleguide reference page

christa 10 days ago
nevermind! I was able to reproduce by using the gem in GCF (was using the test app before). thanks for flagging

@hartsick
Copy link
Contributor Author

Laura and I figured this one out! it looks like GCF has its own copy of prism-rails in its gemfile that we’ll need to remove; this was causing the 'caching' problem Travis described above. then things seem to work fine. Going to merge!

@hartsick hartsick merged commit 3c4d07f into master Nov 14, 2019
@hartsick hartsick deleted the vendorize-prism branch November 14, 2019 21:46
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.

2 participants