-
Notifications
You must be signed in to change notification settings - Fork 88
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
Webpacker / Rails 6 #75
Comments
@jttmckee currently use https://github.com/Alex-D/cookies-eu-banner
|
@jttmckee Thank you for the solution regarding
Basically the notice is generated as expected, however I can't accept it with "Ok" button. |
yarn add js.cookie |
Gem.loaded_specs['cookies_eu'] is nil for me, even though Gemfile.lock lists the gem appropriately. That keeps my .js.erb file from working. I tried an old Bundler (1.17.3) and a new one (2.1.2) and I have the same result with both. It looks like if I add a line higher in application.js.erb I can fix it:
|
We can't really make it work for RoR 6, but what you could do (even it's not suggested by the rails team) is #85 (comment) Not sure what could we do more here :( |
Ok, it took me half a day to get this to work. This is what i did in the project directory:
In the javascript/packs/application.js i added 3 lines of code:
The first 2 lines are to make js.cookie available. The new create file javascript/packs/gems.js.erb has the following content:
Tips:
Final thoughts: At the end of the day, i realized this gem is not what i needed. |
Please note that there is a subtle bug in here. While the So the right steps are: import Cookies from 'js-cookie';
window.Cookies = Cookies; |
Bodatas answer does not include the css. The file gems.js.erb could be used to do that. Add this:
|
Hi this gem doesn't work with Rails 6 in the default configuration as the asset pipeline has been replaced with Webpacker (at least for Javascript). Is there any chance you could add a package.json and load to NPM? I can't figure out how else to get it to work with Webpacker!
The text was updated successfully, but these errors were encountered: