I have been working on structuring the JavaScript files in my project. I opted to use NPM for managing modules and Grunt for concatenating and compressing js and css files for deployment purposes.
Here is the current structure I am using:
-[project root]
-- [node modules]: contains packages like requirejs, jquery, semantic-ui etc. installed via npm
--[war]
---[Dev]
----[css]: multiple css files from the modules (Question 2:?)
----[js]: multiple js files from the moduels (Question 2:?)
- Gruntfile.js: used for concatenation and compression
---[Production] -
----[css]: directory for compressed and concatenated css files
----[js]: directory for compressed and concatenated js files
Question 1: Do you think the above approach to structuring the project is correct? Are there any other recommendations that would help with managing packages, dev, and production files more efficiently?
Question 2: Is there a way for NPM or another tool to automatically move js and css files from the [node modules] folder to the [dev >> css] or [dev >> js] folders? If I do this manually, how can I keep track of the versions? It seems like there might be a better solution out there that I am missing.
Any suggestions, recommendations, or comments would be greatly appreciated.
Thank you!