scotch / angular-brunch-seed

AngularJS + Brunch
Other
228 stars 78 forks source link

node_modules directory goes missing #66

Closed geeklisted closed 11 years ago

geeklisted commented 11 years ago

Kyle,

Sorry for yet another problem...I've been battling a component.json issue, where in the 'google-code-prettify' package was being installed but yet not actually working. In the process, something happened and the /node_modules directory at the top-level of my seed application has just gone missing.

I can still run bower and brunch, but they refuse to do much without /node_modules. Is there any way to 're-seed' the project?

Thank you.

kylefinley commented 11 years ago

Running:

./scripts/init.sh

reinstalls the node modules.

where in the 'google-code-prettify' package was being installed but yet not actually working.

You will need to manually add the 'google-code-prettify' files and assets that you would like included. See this question for an example -- hopefully this won't be necessary in the future.

Does that help at all?

geeklisted commented 11 years ago

Kyle - thank you; I want to say that init.sh may have been responsible for removing the /node_modules directory and honestly, after running it again, it still did not return.

However, I did create a new skeleton app and copy the /node_modules directory from new to old and I'm back in business.

As to the google-code-prettify package, you are absolutely right. I have to admit this has been one of the more confusing aspects of brunch...why do some packages, for example "datatables", get included into vendor.js without any additional work, while others need to be called out in the config.coffee file? In addition, I can actually say that the "google-code-prettify" code WAS included in the built vendor.js file before I added it to the config.coffee file, weird yes?

This would also explain why some other modules aren't working out of the box, such as FuelUX.

Thanks for your fast and helpful responses.

kylefinley commented 11 years ago

I have to admit this has been one of the more confusing aspects of brunch...why do some packages, for example "datatables", get included into vendor.js without any additional work, while others need to be called out in the config.coffee file? In addition, I can actually say that the "google-code-prettify" code WAS included in the built vendor.js file before I added it to the config.coffee file, weird yes?

I'm sorry for the confusion -- the confusing behavior is my fault not Brunch's. Brunch does not yet support Bower packages natively. With Brunch, a developer will place third party packages in the vendor directory. Brunch will then decide what to include using a regular expression established in the config.coffee file.

A few months ago we decided to add Bower support to angular-brunch-seed. To make Bower work with Brunch we had to download Bower packages in the vendor directory. Having these two separate mechanisms each parsing the same directory can lead to strange behavior. We are hoping to move the Bower packages to the packages directory in the future, which should eliminate some of these issues.

geeklisted commented 11 years ago

Kyle - thanks for your explanation; I hope my confusion has not caused you any consternation. :)

Bower is really cool and I suppose I jumped into Brunch + Bower a bit too eagerly; it might have been best to first play around with each respectively.

In the meantime, would you recommend placing third-party vendor tools that are not part of the angular-brunch-seed directly into the /assets/css and /assets/js folders, respectively?

Thanks again for your awesome work and helpful replies.

kylefinley commented 11 years ago

Kyle - thanks for your explanation; I hope my confusion has not caused you any consternation. :)

Not at all. The issue you have brought up are things that need to be worked on. It's good to have them brought into the light.

Bower is really cool and I suppose I jumped into Brunch + Bower a bit too eagerly; it might have been best to first play around with each respectively.

While knowledge of both can help, it shouldn't be a prerequisite. With clearer separation and better documentation I hope to make the learning curve less steep in the future.

In the meantime, would you recommend placing third-party vendor tools that are not part of the angular-brunch-seed directly into the /assets/css and /assets/js folders, respectively?

Maybe. It really depends on what the asset is. If you place the files in /assets/ you will have to include separate links in your index.jade file. However, if you place the files in vendor or app they will be combined and minified into _public/js/vendor.js and _public/js/app.js respectively. I think there's value in either approach depending upon factors like cacheing. The typically Brunch approach is to include everything into these vendor.js, vendor.css, app.js, and app.css files.

Thanks again for your awesome work and helpful replies.

You're welcome!

P.S. for brunch to combine css into app.css. You will have to add the css-brunch package (https://github.com/brunch/css-brunch) to your dependencies list in package.json ( I don't remember why this isn't there by default).

  "dependencies": {
   ...
    "css-brunch": ">= 1.5 < 1.6",
   ...
  }