cmacdonnacha / angularjs-foundation-boilerplate

A simple and well structured boilerplate project based on AngularJS and Zurb's Foundation.
MIT License
9 stars 2 forks source link
angularjs angularjs-foundation-boilerplate e2e-tests zurb-foundation

angularjs-foundation-boilerplate

A simple and well structured boilerplate project based on AngularJS and Zurb's Foundation

Features

Live Demo

Check out the live demo

Setup

  1. Install Git and NodeJS
  2. Install Grunt and Bower globally: npm install -g grunt-cli bower
  3. Install Karma globally: npm install -g karma
  4. Install PhantomJS headless browser globally: npm install -g phantomjs
  5. Install Protractor globally: npm install -g protractor
  6. Install Selenium web driver binaries by running: webdriver-manager update (installs the Chrome driver by default)
  7. Install a local Http server: npm install -g serve (for local web testing)

NOTE: If you have previous versions of any of the above packages, it's recommended that you update them: npm update -g

Install Project Dependencies

  1. git clone https://github.com/cmacdonnacha/angularjs-foundation-boilerplate.git myApp
  2. cd myApp
  3. npm install - this installs both the required NodeJS modules and the bower component libraries.

IMPORTANT: If you run into any issues please have a look at the "Troubleshooting" section at the bottom of this page.

Quick Usage

Running unit test reports

  1. grunt reports: will create and serve the 'reports' folder
  2. Navigate to http://localhost:22000/

Project Structure

This project follows a "Folders-by-Feature" structure very similar to John Papa's Styleguide. From the folder structure below you can see that there are 6 separate components, a folder for each one. Each component is treated as a mini Angular app. This structure allows us developers to easily locate code and identify what each file represents at a glance. By retaining this structure the project is much more manageable as it grows.

alt text

Adding a new component

As you can see in this boilerpate project we have 6 sample components: about, common, home, layout, sample and topbar. Check out the wiki to see how you can go about adding your very own component.

Making Foundation Styles your own

Foundation is great because it comes with basic styling, leaving it up to you to give it your very own touch. You can do this by changing the _settings.scss file inside the styles folder:

alt text

Simply uncomment any of the sections in the _settings.scss file and you will override the default Foundation styling. Don't like the color of the topbar? No problem, change to a nice bright pink instead. Find out more here.

Troubleshooting

Even crème de menthe projects have their issues. Here are some problems you may face along with some suggestions on how to resolve them:

1. Issue: I'm getting the following error when running npm install: "Error: EPERM or operation not permitted or permission denied"

This error means that NPM was not able to install one of the node modules to the file system. There are three major reasons why this could happen:

Suggestion:

  1. Run npm cache clean.
  2. Run npm install again.

2. Issue: I'm getting the following error when running npm install: "Error: Can't find Python executable 'python', you can set the PYTHON env variable."

Suggestion: This error can be ignored (it's a warning really) as the node modules will install successfully anyway. The reason this error appears is because some node modules have dependencies on a clunky build tool called node-gyp that compiles C++ extensions for NodeJS, and it requires python. Long story short, if you don't have Python installed on your machine you will see these errors but it's nothing to worry about.

3. Issue: I'm getting an error when running the grunt production task.

Suggestion: Make sure you have administrator permissions to delete folders from the directory. If you're still seeing the issue then manually delete the production folder and run grunt production again.

4. Issue: I'm getting the following error when running the grunt test task: "No selenium server jar found at the specified location"

Suggestion: Run the following command and try again: webdriver-manager update

5. Issue: I'm still getting an error when running the grunt test task.

Suggestion: Make sure you have Java installed. Close and re-launch the command line and try again.

6. Issue: I'm getting the following error "Error: Cannot find module 'stylus'"

Suggestion: Run the following command: npm install stylus -g

7. Issue: I'm getting the following error when running the grunt watch task: "Error: 'libsass' bindings" not found. Try reinstalling 'node-sass'

Suggestion: Run the following command: npm install grunt-sass

8. Issue: Bower hangs and cannot fetch the libraries when running npm install

Suggestion: Set Git global options to fetch components over 'https' instead of 'git' by running the following command: git config --global url."https://".insteadOf git://

9. Issue: None of the above solutions have helped

Suggestion 1:

  1. Stop the grunt watch task.
  2. Run grunt clean
  3. Run grunt watch again.

Suggestion 2:

This project has been tested with the following tools:

If you are running into issues while installing node packages then ensure you have the versions above installed.

Contribute

Believe it or not, angularjs-foundation-boilerplate is not perfect. If you want to improve it somehow then by all means go ahead and create a pull request :-)

Changelog

1.0.1

06/11/2015

1.0.0

30/10/2015