requirejs-rails
requirejs-rails copied to clipboard
Improved README
I have re-worked the Usage section of the README after I had some trouble getting started with it myself. Gist is https://gist.github.com/eoinkelly/5778004 - let me know if there any changes required. Will make a PR if you are happy with it.
Main Changes
- Removed Backbone from the examples. If a user is new to requireJS there is a lot to grok at first - I think that keeping the examples as simple as possible is helpful here.
- Vanilla JS and Coffeescript examples (no judgements here ;-)
- The JS/Coffeescript example log some debugging info to the console to help users verify that the setup worked.
- Added an example
requirejs.yml
which shows how to create an adapter to auto-load rails unobtrusive JS. I believe that getting this working will be what the majority of users want to achieve. This can be error-prone because the requireJS config docs refer to JS and must be converted to YAML so I think an example that demonstrates a working configuration is useful.
Questions
- I needed to restart my rails server before it picked up any changes to
config/requirejs.yml
- is this expected behaviour? If so, we should mention it in the README. - Would creating a generator that creates a working installation be worthwhile? I feel it would be helpful for lowering the bar for new users.
- The YAML parser crashes if
config/requirejs.yml
exists but is has no content (comments don't count). Is this a bug or should I document it in README also?
If any of those are bugs I'll make issues for them.
HTH /Eoin/
As a non-coffee script developer, I really appreciated the vanilla JS examples. It would be very helpful to others like me if they were incorporated into the official README.