mountain_view icon indicating copy to clipboard operation
mountain_view copied to clipboard

[alternative idea] Use application css

Open paulkoegel opened this issue 9 years ago • 2 comments

this is just an idea and a suggestions. i'm totally fine if you stick with your decisions and conventions.

WHY? i couldn't overcome issues with integrating global styles (see https://github.com/devnacho/mountain_view/issues/35) and started reading the source code. came up with this alternative idea, which i find a lot simpler and serves me as my current workaround / think i'll probably stick with my fork.

WHAT

  • don't construct styleguide's CSS from .scss files in app/components
  • move components' CSS files to app/assets (breaks your idea of putting all related files of a component into one folder)
  • simply load application.css in styleguide -> no more hassle loading global stylesheets, and guaranteed to have the same CSS code as on production
  • use safer CSS class names for styleguides sidebar, navigation etc. mv-... -> .mountainview-styleguide-... - someone out there sure has an .mv-sidebar...
  • don't use a CSS reset for the styleguide (see https://github.com/devnacho/mountain_view/issues/37)
  • load application.css after the styleguide's own mountain_view.css, to make everything overridable from there
  • add class to styleguide's <body> to make its style overridable from application.css

Would love to hear your ideas! and as i said, no hard feelings if you decide against this because you prefer your current approach. would be glad if the issues i came across would be fixed, though :) thanks for building mountain_view!

paulkoegel avatar Mar 17 '16 14:03 paulkoegel

Here's the sample Rails app I used to build this mountain view fork: https://github.com/paulkogel/mountain_view_demo_forked

paulkoegel avatar Mar 17 '16 15:03 paulkoegel

Hi @paulkogel. Thanks for contributing!

I like the .mv- to .mountainview-styleguide- rename, makes sense at it makes collisions less probable. And same for adding a class name to the body.

I'm not so sure about adding the global application.css to the styleguide though. Some applications may not have that, but have it broken app separately or named differently. Also, it may conflict with the styleguide styles if some components are re defined at the tag level (similar to what you describe with reset.css) Maybe it would be nice to make that configurable, in case somebody wants to overwrite the styleguide.

Also, there's always the chance to add your own app/views/layouts/mountain_view.html.erb in your app and override the gem one. That will give you way more flexibility.

Interested in hear what you think.

kitop avatar Mar 17 '16 15:03 kitop