This provides the styling and layout for Cevo Precise Portfolios and Profiles.
Great! Here's how you do it:
- 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 dependencies using
npm install
thennpm install npm@latest -g
thennpm install less -g
- Complte less to css with
grunt less
- Run the developer server with
grunt
- Open http://localhost:9001/profile in your browser to see a Profile with your styling.
- Open http://localhost:9001/portfolio in you browser to see a Portfolio with your 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. Note We recommend usingbundledDependencies
. This removes the need to installed dependencies from NPM at runtime resulting in faster install and no downtime should NPM go down. 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. -
assets
: This directory contains any JS and CSS. We've using the Less precomplier for CSS so just be sure to make changes to the.less
files. The Grunt build generates the CSS. Be sure to add the generated css files to your version control.
Also worthy of a mention is the example Profile and Portfolio JSON. exampleProfile.json
and examplePortfolio.json
. These files provide example data during development. You
can modify to suit your needs but you must ensure they conform to the Precise
schema.
You may want to include images in the theme you are developing. There are two options:
- Reference assets from an external URL. You may have these images already hosted elsewhere. Simply reference them via their HTTP URL.
<img src="http://external.com/images/example/png" />
- Use Base64 encoding in CSS. You can embed images directly into your CSS. Note that there are some limitations to using this approach.
.image {
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA...);
}
When you are done with making it look good it's time to deploy:
-
Bump the version in your package.json file.
-
Stage the package.json change.
-
Commit that change with a message like "release 0.1.5"
-
Git tag
git tag -a 0.1.5 -m 'release 0.1.5'
-
Generate the css
$ grunt less
-
Package into tarball using
$ npm pack
Once packaged:
- Login to Precise
- Open the theme page /theme
- Upload your new release from your local machine.
- 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.