simpliflow / Rails-Styleguide

0 stars 0 forks source link

Webpack integration rules #5

Open peterhassler opened 7 years ago

peterhassler commented 7 years ago

We currently follow following schema to integrate webpack/vue-components in FCS:

  1. Component namespace -> Webpack entrypoint (StructurePlanning -> /webpack/structure_planning)

  2. Do not access global javascript libs in webpack code!!

  3. Pass data from asset pipeline to webpack code: 1. Pass in through entry point vue initializer, 2. Use vue properties as much as possible, 3. For more complex situations, create a interface and pass in an adapter

  4. Include entrypoint only when needed

    # _athlete_training_structure_plan.html.haml
    - content_for :page_specific_javascript do
    = javascript_include_tag *webpack_asset_paths('structure_planning')
  5. (needs additional styling in FCS?) create own stylesheet: module_component.scss

    • (Better to manually include it too? Like with javascript_include_tag)

We may profit from providing rules for this. What do you think?

tomgong commented 7 years ago

As long as we use a custom solution (until we upgrade to Rails 5.1 which could take a while ;-)) I think it's a good idea to have these rules. I would provide examples for integration with asset pipeline.

peterhassler commented 7 years ago

Architecture meeting: Add to style guide and add examples for point 3