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
Access helpers in examples #135
Comments
Also for |
This is a nice-to-have feature, but should probably live in a separate |
I would like to do the split in into several Gems for v3. |
+1 for this. In rails a lot of the components we develop use helper methods so this would enable marrying up the actual implementation that we recommend with what's in the styleguide, rather than having to paste a helper methods output. For example, we're using the |
As I’m not using Rails myself right now, I’m happy to accept contributions here. Also for version 3 the core will be written in JavaScript. It might be good to implement this on top of it. |
Thanks for the swift reply @hagenburger. I'm not a Rails dev myself, stick to the front end, so might not be well placed to implement this. May be able to contribute on the front end, depending on what I've got on at the time. |
All fine, let me know if you want to help out. Feel free to join our Slack channel: https://join.slack.com/t/livingstyleguide/shared_invite/enQtMzA5NDkyOTQ0NjI2LWM0YWU5OWIxOTJhZjZjZTNjNDRiNjE0MTUwOWM4MDM2OTkwYjI0NTljZDdjYjg1NjVjZTk3NjlmMDgzYzBiZGY |
Allow to add helper methods to style guide examples.
Example usage
app/helpers/form_helper.rb:
app/assets/index.html.lsg
Same example using Haml:
Implementation
FormHelper
is defined, it should load it into the scope of examples.FormHelper
is not defined, it should try to require aform_helper.rb
first.@helpers FormHelper
into the corresponding place)It might be useful to provide a way to load all helpers defined in a Rails application. This should not be done by default as some helpers might have dependencies that conflict in the style guide. As @myabc mentioned in the comments, this should be done in a separate Gem (
livingstyleguide-rails
). Using@helpers
should not be limited to Rails environments.Middleman provides a similar way to load helpers. It would be nice if this would automatically make them available to LivingStyleGuide examples.
Tasks
app/helpers
to the load path if Rails is definedThe text was updated successfully, but these errors were encountered: