material-design-for-wordpress icon indicating copy to clipboard operation
material-design-for-wordpress copied to clipboard

Assets directory inconsistency

Open ravichdev opened this issue 4 years ago • 4 comments

Issue by dugajean Wednesday Apr 29, 2020 at 20:27 GMT Originally opened as https://github.com/xwp/material-design-wp-plugin/issues/203


In the assets/ directory we have the following directories:

  • css
  • js
  • src

This doesn't make much sense, as src contains JS code which when compiled goes to the js folder. So now we have folder right under assets which include JS code.

This isn't the case for css. In this folder, we initially have all the compiled CSS and another inner src/ folder which contains the CSS we code in (assets/css/src).

This whole structure is quite messy and unintuitive to newcomers and should be changed into a more consistent structure.

Proposed solutions:

  1. Have a css and a js folder right under assets; The compiled assets are right there under these folders, but there's also a src folder in each of these folders containing the actual source code. In short: replicate what CSS has to the JS side.
  2. Have a css, a js folder and a dist folder - right under assets; This dist folder contains both compiled JS and CSS. The css and js folder hold their respective source files.

One of these two solutions guarantees consistency and reduces confusion at navigating theses project files.

Input welcome.

ravichdev avatar Apr 01 '21 18:04 ravichdev

Comment by dugajean Wednesday Apr 29, 2020 at 20:29 GMT


@ravichdev @davidlonjon @derekherman

ravichdev avatar Apr 01 '21 18:04 ravichdev

Comment by davidlonjon Thursday Apr 30, 2020 at 02:32 GMT


Hi @dugajean ,

I agree with you that this structure is confusing and I would prefer to go towards the second solution you highlighted which makes more sense to me and more align with what many other projects is/might do.

ravichdev avatar Apr 01 '21 18:04 ravichdev

Comment by technosailor Tuesday Dec 15, 2020 at 19:49 GMT


I'd offer a third option that I think is even more intuitive to someone coming into the project.

Under assets, have dist and src. Under dist, js and css. These are compiled assets. Have the same directories under src. This is the source code under development.

assets/
  |-dist
    |-css
    |-js
  |-src
    |-css
    |-js

Thoughts?

ravichdev avatar Apr 01 '21 18:04 ravichdev

Comment by ravichdev Thursday Jan 21, 2021 at 12:52 GMT


I like option 1 as that will also ensure we have assets/js/[DIST JS FILES] and assets/css/[DIST CSS FILES] in the plugin build file and the WP SVN repo.

PR #501 is open with option 1 changes.

ravichdev avatar Apr 01 '21 18:04 ravichdev