Dwayne Purper

Joined

60 Experience
0 Lessons Completed
0 Questions Solved

Activity

Posted in Components with Phlex in Rails Discussion

Agreed, I've already migrated some views to ViewComponent, and now I'm at a crossroads.

Posted in Components with Phlex in Rails Discussion

Thanks, Adam, great intro to Phlex! I appreciate how you took one step at a time -- including the errors -- and didn't try to polish too much beforehand, letting us work through and fix the problems with you.

Not sure if this answers it for you, but for external libraries, I've gotten either of these to work, depending on whether loading locally from node_modules or remotely from CDN:

// Load from node_modules
@use 'flatpickr/dist/themes/material_blue.css';

... or ...

// Load from CDN
@import url('https://npmcdn.com/flatpickr/dist/themes/material_blue.css');

Contributing to open-source projects always seems intimidating, so it's nice to see examples that are accessible and straightforward. Thanks for this.

Posted in How to use jQuery & jQueryUI with Esbuild Discussion

Two things to check.

1) If you're sprinkling snippets of jQuery in your views, you'll want to look at application.html.erb and make sure the javascript_include_tag does not have "defer: true". So just:

javascript_include_tag "application", "data-turbo-track": "reload"

2) If you are using jQuery in your Stimulus controllers, make sure to import the jQuery before you import the controllers. I had to do:

import "./src/jquery"
import "./controllers"

Posted in How to use jQuery & jQueryUI with Esbuild Discussion

If we're not using jQueryUI or any library that depends on jQuery, then are these lines enough by themselves?
window.jQuery = jquery;
window.$ = jquery;

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2024 GoRails, LLC. All rights reserved.