Coder Social home page Coder Social logo

precise-theme-starter's Introduction

Precise Theme Starter

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.

So you want to theme a Portfolio or Profile

Great! Here's how you do it:

  1. Copy or Fork this repository
  2. Install development dependencies
  3. Run the development server
  4. Create your desired HTML markup and CSS
  5. Package as a NPM
  6. Deploy

Getting your development environment setup

After cloning this repository, you need to install:

With that done:

  1. Change to the directory your copied this repository.
  2. Install project depenencies using npm install
  3. Run the developer server with grunt

Open http://localhost:9001/profile in your browser. You should see a Profile with default styling.

Make it look good

With your development environment up and running you're ready to begin theme creation.

What goes where

It's pretty simple:

  • package.json: This file describes your NPM package. The most important fields and the name and version. If you have any dependencies such as a template engine include them in the dependencies field. Note We recommend using bundledDependencies. 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 to index.js. This file is really important. It's the glue between the incoming JSON and your markup / css. You must provide 2 functions: renderProfile() and renderPortfolio(). 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 as profile.template but for Portfolios.

  • style.css: All your CSS.

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.

Images

You may want to include images in the theme you are developing. There are two options:

  1. 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" />
  1. 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...);
}

Deployment

When you are done with making it look good it's time to deploy:

  1. Bump the version in your package.json file.

  2. Stage the package.json change.

  3. Commit that change with a message like "release 0.1.5"

  4. Git tag git tag -a 0.1.5 -m 'release 0.1.5'

  5. Push the change to git

  6. Package into tarball using

    $ npm pack

Once packaged:

  1. Login to Precise
  2. Open the theme page /theme
  3. Upload your new release from your local machine.
  4. After a short pause the theme should be available to preview or select.
  5. Preview the theme to ensure all is well before making permanent.
  6. Rinse and repeat as required.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.