Closed nicolas-brousse closed 5 years ago
@florentferry, @Spone, Some questions:
mountain_view
does? (https://github.com/devnacho/mountain_view#adding-extra-pages-to-the-styleguide)For now, let's not add extra pages. For the assets, can we have a dedicated pack?
We could also have components styleguide/header
and styleguide/footer
in the engine, that you can override in your project if you want to customize them.
For the assets, can we have a dedicated pack?
Not sure this part is easy to do. For now I just put style inside a style tag.
Otherwise I:
komponent_components
Komponent::Styleguide
controller and index
, show
viewskomponent/styleguide/(header|container|footer)
_example.html.(engine)
file on component generationKomponent::Component
class to easily list or find a component (may be it could improve by using the path resolver)I will continue this later, may be in the next week.
I was thinking a bit about assets this last days and I notice two problems:
I worked on the default UI today. Here is what it looks like:
We discussed the next steps with @nicolas-brousse.
The idea to allow customization of the styleguide, and easy setup, is to:
rails g komponent:styleguide
that will:
frontend/components/komponent
to the main app folder (probably using Thor directory action)frontend/packs/komponent.js
that will contain:
import 'components';
import 'components/komponent';
routes.rb
This way, the user can customize the UI of the styleguide, by modifying components and reusing CSS variables from the main app. It's also possible to add JavaScript in those components, if needed. The assets are compiled using webpacker, with the same process as the main app existing pack.
[x] when rendering the it's easier to create a separate helper, so that's what I did: _example.html.slim
file in the styleguide, we could override the component
helper, to output the component, followed by the source code to copy-paste (and maybe the resulting HTML code as well)component_with_doc
(aliased as cdoc
)
[x] add a generator rails g komponent:examples
that would generate an example file for each existing component (to help users setup a styleguide with an existing code base)
Totals | |
---|---|
Change from base Build 699: | 0.2% |
Covered Lines: | 180 |
Relevant Lines: | 181 |
I made some changes:
frontend
folder into generators templates.komponent:styleguide
generator and regroup common generators methods in a Utils module.What needs to be done:
Komponent::Component
by using Komponent::ComponentPathResolver
What I noticed:
Thanks for the progress!
Decide to use Engine or Railtie or both
Can you explain?
Design seems to be broken in Firefox, not sure if I broke something with my lasts commits.
Do you have a screenshot?
@nicolas-brousse I added more tests, we're now back over 98% coverage. What's left to test is:
About Railtie vs. Engine:.
Any Rails::Engine is also a Rails::Railtie
Source: https://api.rubyonrails.org/classes/Rails/Engine.html
So I don't see any issue in using an Engine :)
About Railtie vs. Engine:
Okay. It was just to be sure with you and have your advice if needed.
Here are a few more tasks:
app/views/komponent/static/
I created #114 to do "support for adding static pages: add routes in the engine, so you just have to create the views in app/views/komponent/static/
" in a separate PR
A really work in progress about adding style guide view.
Komponent::Component
by usingKomponent::ComponentPathResolver
@nicolas-brousseSupport for namespaced components in nav:arrow_right: #125Closes #94.