This is an example of how to create a theme for Precise Portfolios and Profiles. Consider it a starter pack. Use it a guide for your own theme.
Great! Here's how you do it:
- Copy or Fork this repository
- Install development dependencies
- Run the development server
- Create your desired HTML markup and CSS
- Package as a NPM
- Deploy
After cloning this repository, you need to install:
With that done:
- Change to the directory your copied this repository.
- Install project depenencies using
npm install
- Run the developer server with
grunt
Open http://localhost:9001/profile in your browser. You should see a Profile with default styling.
With your development environment up and running you're ready to begin theme creation.
It's pretty simple:
-
package.json
: This file describes your NPM package. The most important fields and thename
andversion
. If you have any dependencies such as a template engine include them in thedependencies
field. As with any software package you must bump the version on every release. -
index.coffee
: We're using Coffeescript. If you prefer Javascript rename this file toindex.js
. This file is really important. It's the glue between the incoming JSON and your markup / css. You must provide 2 functions:renderProfile()
andrenderPortfolio()
. Both functions take a single argument - either the Profile JSON object or the Portfolio JSON object. The job of this file is to apply the JSON to the template and include relevant CSS. -
profile.template
: This file contains the HTML Markup needed for your Profile. You can use from favourite templating language or stick with the one we used -- Handlebars. -
portfolio.template
: Same asprofile.template
but for Portfolios. -
style.css
: All your CSS.
Also worthy of a mention is the test Profile and Portfolio JSON located in
the ./test
directory. You can modify the JSON to suit your needs. It's only
used during development.
When you are done with making it look good it's time to deploy:
- Check you have updated
package.json
especially incrementing the version number. - Run
npm pack
. This create a local NPM package as a tar ball. - Login to Precise and open the Manage Theme page.
- Upload your new NPM package.
- After a short pause the theme should be available to preview or select.
- Preview the theme to ensure all is well before making permanent.
- Rinse and repeat as required.