|
2 | 2 |
|
3 | 3 | The project is a quick starter for AngularJS applications consuming content from Contentful, a content as a service provider.
|
4 | 4 |
|
| 5 | +You just have to sign-up for a Contentful account which is totally free, create a space and grab your "Management" API key for when you initialize the project. We'll import the sample content model along with the content to your space so you have a starting point to experiment from. It's quick and simple to register for a space, as is the upload process for the sample data into your own space. |
| 6 | + |
| 7 | +You can then customize the content model to your liking as the content model and data will be under your own personal Contentful space. Shout-out to [Stefan Judis](https://github.com/stefanjudis) from Contentful for the heads up about the import & export modules. |
| 8 | + |
5 | 9 | <img src="https://images.contentful.com/fo9twyrwpveg/44baP9Gtm8qE2Umm8CQwQk/c43325463d1cb5db2ef97fca0788ea55/PoweredByContentful_LightBackground.svg" width="225" style="margin-left: 20px;" /><img src="https://angular.io/assets/images/logos/angular/angular.png" width="80" /><img src="https://v4-alpha.getbootstrap.com/assets/brand/bootstrap-solid.svg" width="60" />
|
6 | 10 |
|
7 | 11 |
|
@@ -33,22 +37,44 @@ and npm is simply a node package which is a package manage in itself. It allows
|
33 | 37 |
|
34 | 38 | Just [fork](https://github.com/joshhebb/angularjs-contentful-starter) or pull down the repository and run the following commands.
|
35 | 39 |
|
| 40 | +**Before you start** when you run the final step of this setup, you will be asked to enter your space ID, delivery and management API keys from Contentful. If you haven't registered for a account [head over to Contentful](https://www.contentful.com/sign-up/#dev) and get started. |
| 41 | + |
| 42 | +The three pieces of info you need from Contentful: |
| 43 | + |
| 44 | +* Space ID : the identifier of your space which is your personal collection of models & content |
| 45 | +* Management API token : content management tokens |
| 46 | +* Personal access token : content delivery tokens |
| 47 | + |
| 48 | +Read more about the [authentication tokens on Contentful](https://www.contentful.com/developers/docs/references/authentication/). |
| 49 | + |
| 50 | + |
36 | 51 | ```shell
|
37 | 52 | git clone https://github.com/joshhebb/angularjs-contentful-starter.git your-project-name-here
|
38 | 53 | cd your-project-name-here
|
39 |
| -npm install -g gulp # Install Gulp (global) |
40 |
| -npm install -g bower # Install Bower (global) |
41 |
| -npm run init # Run init task to install the node modules, libraries and then call gulp to build the app |
| 54 | +npm install -g gulp # Install Gulp (global) |
| 55 | +npm install -g bower # Install Bower (global) |
| 56 | +npm run init # Run init task to install the node modules, libraries and then call gulp to build the app. |
| 57 | + |
| 58 | +Starting the Contentful Export & Import Process.. |
| 59 | +Please enter your Contentful Space ID and your Content Delivery / Management Tokens. |
| 60 | +You can find those values in Contentful under your space. |
| 61 | + |
| 62 | +prompt: spaceId: your-space-id |
| 63 | +prompt: accessToken: your-content-delivery-access-token |
| 64 | +prompt: managementToken: 22 your-content-management-token |
| 65 | + |
| 66 | +# The models & content are then exported from the sample space and uploaded into the space you created. |
| 67 | + |
42 | 68 | ```
|
43 | 69 |
|
44 |
| -### Contentful Integration |
| 70 | +If everything goes okay, you will have imported the content model into your space and built the project. You're now ready to start development! |
45 | 71 |
|
46 |
| -The project relies heavily on Contentful which is a headless CMS. It's a content as a service provider that exposes it's content through rest APIs exposing content as JSON, easily consumed in Angular. |
47 | 72 |
|
48 |
| -When you pull down the project - it will be pointed at my Contentful space which has content to imitate an Apple store selling some categorized products, with some additional store information hosted on the site as well as a simple blog. I was curious how the component relationships would work and it is what drove my content modelling. |
| 73 | +### Contentful Integration |
49 | 74 |
|
50 |
| -You can either experiment with the JSON that's returned to you, or rip out any implementation details in the context of my Contentful space and start on your own content model. |
| 75 | +The project relies heavily on Contentful which is a headless CMS. It's a content as a service provider that exposes it's content through rest APIs exposing content as JSON, easily consumed in Angular. |
51 | 76 |
|
| 77 | +One of the cool things about Contentful is that it ships with an export and an import API - so the project is setup to upload the sample content model that I created, along with sample content, into your space in seconds - you just need to register for a Contentful account and setup a space. No credit card required. |
52 | 78 |
|
53 | 79 | ### Gulp Tasks
|
54 | 80 |
|
@@ -94,7 +120,6 @@ Some things to know:
|
94 | 120 | <img src="http://whobrokethebuild.me/wp-content/uploads/images/angular-contentful-starter.gif" />
|
95 | 121 |
|
96 | 122 |
|
97 |
| - |
98 | 123 | ### Adding AngularJS Libraries
|
99 | 124 |
|
100 | 125 | The project uses one of the node packages to install libraries - bower. The process is simple - run the bower command specifying the library (and optional version) with the save command which will download the library into our lib folder which we can reference.
|
@@ -127,5 +152,25 @@ If you remove a library:
|
127 | 152 | * Remove any references in the application or in index.dev.html
|
128 | 153 |
|
129 | 154 |
|
| 155 | +### Common Setup Problems |
| 156 | + |
| 157 | + If you run into issues with npm and are seeing weird errors - won't worry, it's unfortunately all too common! The first thing I usually do is delete the node_modules and run an 'npm install'. Keep in mind that folder is not checked into the repository, and is easily rebuilt from the information in package.json. |
| 158 | + |
| 159 | + * Delete node_modules in project |
| 160 | + * run 'npm cache clean' |
| 161 | + * run 'npm install' |
| 162 | + |
| 163 | +If that doesn't work, I usually assume it's a node.js (or its module npm) versioning problems. Keep in mind npm is a component of node.js, so first verify your node version first: |
| 164 | + |
| 165 | +```shell |
| 166 | +# Check the node version |
| 167 | +node -v |
| 168 | + |
| 169 | +# Check the npm version |
| 170 | +npm -v |
| 171 | +``` |
| 172 | + |
| 173 | +At the time of writing this, I am on **node.js v8.9.4** and **npm v5.6.0** which are the latest production releases. If you still have problems, check out my blog post about wiping and reinstalling node & npm fresh: |
130 | 174 |
|
| 175 | +[http://whobrokethebuild.me/fixing-broken-node-install-windows/](http://whobrokethebuild.me/fixing-broken-node-install-windows/) |
131 | 176 |
|
0 commit comments