Skip to content

Revising the template structure #135

@halfzebra

Description

@halfzebra

After the discussion in elm-community Slack channel, @eeue56 pointed out, that Create Elm App does not follow the common consensus on the application template structure.

Structure variations

Current

my-app/
  .gitignore
  README.md
  elm-package.json
  src/
    App.elm
    favicon.ico
    index.html
    index.js
    main.css
  tests/
    elm-package.json
    Main.elm
    Tests.elm

elm-community consensus

my-app/
  site/
      favicon.ico
      index.html
      index.js
      main.css
  elm/
    .gitignore
    README.md
    elm-package.json
    src/
      Main.elm
    tests/
      elm-package.json
      Main.elm
      Tests.elm

Introduced in #124

my-app/
|-- public/ # or site
|   |-- css/
|   |    `- main.css
|   |-- js/
|   |    `- index.js # or main.js
|   |-- media/
|   |    `- logo.svg
|   |-- favicon.ico
|   `-  index.html
|-- src/ # or elm (elm/src seems a bit much)
|   `- App.elm
|-- test/
|   |-- Main.elm
|   |-- Tests.elm
|   `-  elm-package.json
|-- .gitignore
|-- README.md
`-  elm-package.json

The problem

The current structure does not offer a way to handle static assets when a user wants to have static media assets, which are not referenced in index.js

Create React App offers the public folder, as a place for static assets. It also contains index.html, which is included into the webpack process.

The structure offered in #124 makes it harder for us to use public/ folder for static assets, in the way it was implemented in CRA. Also it does not allow us to implement the structure, offered by elm-community.

We also need to have in mind, that #134 will introduce the file or folder for elm-css stylesheets.

#124 will introduce a breaking change to Create Elm App, so we have to agree on the future structure, so it follows the community desires and allows having static content outside the module system(i.e. outside the webpack build)

@fobos @MazeChaZer @lrosa007 Please share your thoughts, I'll pitch this issue in elm-community as well.

  • Moving index.html and favicon.ico to /public
  • Main.elm vs. App.elm
  • Moving index.js to /public

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions