Menu icon Foundation
How to put a ZURB Template project into Git?

What's the correct procedure for publishing a functioning Foundation for Sites 6.3.0 ZURB Template project to a private Git repo and being able to then checkout that project to a new location and have "foundation watch" run without throwing an error?

The ZURB Template project was originally created with the Foundation CLI's "foundation new" and "foundation watch" commands. Otherwise, the project is empty in that no other changes have been made to it yet. Therefore this should be easy to replicate.

I'm on macOS El Cap. I'm getting errors related to missing gulp and babel modules when running "foundation watch" inside my Git checkout at its new location.

Understandably, ZURB's bundled .gitignore file prevents some files from being published to the Git repo. After checking out the repo in a new location, some of those missing files appear to be necessary for "foundation watch" to function properly. I was hoping that by running "foundation watch" those missing files would be reconstituted, but those missing files cause "foundation watch" to throw errors. I also tried running "foundation update" before running "foundation watch", but that doesn't solve the problem. I tried to individually install gulp and babel and that didn’t work either, but perhaps I didn’t do those installations correctly.

Are there instructions anywhere for getting this scenario to work? I see a ZURB lesson named "Use Git to Share Your Work, LESSON #34" but it's not accessible.

Thank you very much.

Jim

 

giterrorBabelgulp

What's the correct procedure for publishing a functioning Foundation for Sites 6.3.0 ZURB Template project to a private Git repo and being able to then checkout that project to a new location and have "foundation watch" run without throwing an error?

The ZURB Template project was originally created with the Foundation CLI's "foundation new" and "foundation watch" commands. Otherwise, the project is empty in that no other changes have been made to it yet. Therefore this should be easy to replicate.

I'm on macOS El Cap. I'm getting errors related to missing gulp and babel modules when running "foundation watch" inside my Git checkout at its new location.

Understandably, ZURB's bundled .gitignore file prevents some files from being published to the Git repo. After checking out the repo in a new location, some of those missing files appear to be necessary for "foundation watch" to function properly. I was hoping that by running "foundation watch" those missing files would be reconstituted, but those missing files cause "foundation watch" to throw errors. I also tried running "foundation update" before running "foundation watch", but that doesn't solve the problem. I tried to individually install gulp and babel and that didn’t work either, but perhaps I didn’t do those installations correctly.

Are there instructions anywhere for getting this scenario to work? I see a ZURB lesson named "Use Git to Share Your Work, LESSON #34" but it's not accessible.

Thank you very much.

Jim

 

James Watkin over 2 years ago

I believe I've found the solution. After cloning my ZURB Template project from my private Git repo, I used these documented commands instead of running "foundation watch", in the following order:

  1. sudo npm install -g bower
  2. sudo chown -R $USER:$GROUP ~/.npm
  3. sudo chown -R $USER:$GROUP ~/.config
  4. npm install
  5. bower install
  6. npm start

The last three commands are documented in the ZURB readme.md installed with the ZURB Template. It might be possible to run the "chown" commands first, before the global bower installation. Or, you might not need to run them at all. I ran them because I couldn't run bower with or without sudo and the following page solved that problem:

https://github.com/bower/bower/issues/2262

Jim

 

James Watkin over 2 years ago

I should point out that my previous post with the “chown” commands led me to begin reading about the cause of my situation. There are various conflicting opinions about the “best” way to install node and npm, and subsequent packages via npm.

As you may already know, options for installing node for macOS include a conventional macOS installer, homebrew, and nvm. And the npm site lists three different ways to install npm. The debate seems to center around whether or not one should use sudo and where the resulting installation folders should be located and what their permissions should be.

I’m new to using macOS (UNIX) for this level of development so I’m currently at the mercy of others regarding best security practices.

Jim

 

James Watkin over 2 years ago

Everything seems to work fine now, after recreating my ZURB Template installation:

I removed everything and started over using nvm. This way, I was able to globally install nvm, node, npm, gulp, and bower without using sudo.

I stopped using the Foundation CLI to create my ZURB Template. I used this ZURB documented "git clone" alternative:

git clone https://github.com/zurb/foundation-zurb-template projectname

I then deleted the ZURB .git directory that comes with this repo.

Then I navigated to my ZURB Template directory and ran "npm install" to create the node_modules/ and "bower install" to create the bower_components/. I now use "npm start" instead of "foundation watch" to get things going.

Jim