Skip to content

Latest commit

 

History

History
29 lines (15 loc) · 1.8 KB

README.md

File metadata and controls

29 lines (15 loc) · 1.8 KB

JavaScript Product Catalogue

This repository shows how to build a Product Catalogue with JavaScript on a website, based on the Contentful starter Product Catalogue example space.

This project uses no specific frameworks and is written in plain JavaScript, making use of browser APIs and HTML/CSS.

The application is split over multiple files which are included via script tags in the index.html file. While this approach is taken here for simplicity, this is not advised for production deployments. Make sure you always bundle up and minify your JavaScript code.

The only external dependencies are the Contentful SDK and the marked Markdown library for rendering markdown content.

Feel free to look at the code and understand how to use Contentful on a bare bones, web based, JavaScript enabled website.

Trying it out

You can try this app at http:https://contentful.github.io/product-catalogue-js

Running it locally

Because this app makes use of the browser's History API you can't just open the index.html file locally on a browser.

You'll need an http server in order to run this.

If you have node.js and npm available, you can run npm install http-server and then run http-server. Now you can open http:https://localhost:8080 in your browser.

If you are on Mac OSX you can also run python -m SimpleHTTPServer in the project directory. Now open http:https://localhost:8000 in your browser.

If you use any other server and serve this in a subdirectory, make sure to set the appropriate value in the <base> tag on index.html

For instance, for http:https://contentful.github.io/product-catalogue-js the tag would look as <base href='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/product-catalogue-js/' />