npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

multicolour-polymer

v0.0.4

Published

Template & Generator for Multicolour framework based on Polymer

Downloads

1

Readme

multicolour-polymer

Polymer front end generator for Multicolour applications. Your CRUD operations are generated for you.

npm i --save multicolour-polymer

On installation; unless you have a content/frontend/src folder already, you'll see a new folder content/frontend/src which contains .jade files.

These files are the default theme for your frontend, before Multicolour will generate anything for you you need to add the below to your app.js.

my_service.use(require("multicolour-frontend-polymer"))
  .request("frontend").generate().watch()

That will do an initial generate and then watch all the files in the src directory and automagically reload the frontend for you.

Why Jade?

Jade is a simple dynamic language that allows you to generate dynamic content without switching technologies or ideologies. A Jade template in Multicolour is turned into HTML and lets you generate these templates while being able to access all model data, type data and backend functionality while writing your themes.

Customising your theme

Once Multicolour has done a generate, you'll see a content/frontend/build folder, this contains html. By default Multicolour:

  1. Generates, per blueprint:
  • {entity}/read.html
  • {entity}/write.html
  • {entity}/list.html
  • {entity}/single.html
  1. Generates an index.html and an elements.html
  2. Generates a home.html
  3. Copies
  • bower.json & bower_components from src
  • css folder
  • js folder
  • assets folder

Multicolour will use read.jade, create.jade, single.jade and list.jade to generate your frontend but you can override any of these for any blueprint by creating a folder with the same name as your blueprint. For instance, you'll see in your src directory a user folder which has list.jade in it. This is a custom list template for the user blueprint. You can do this for any of the default 4 templates, if it exists Multicolour will automatically find it and use it. Magic.

Adding new templates

You can add new, entirely custom theme files are still .jade files. Multicolour won't automatically pick these up but you'll find a frontend.json in your src directory. Inside of this file is an array of template names.

Notice the lack of an extension, by default home is a "directive".

What is expected of a "directive"?

A directive is a custom theme file that isn't one of the default 4 jade files. These templates should appear in your frontend.json files. It doesn't matter if they are in a folder or not but what you expect does. For example, if you have a cool-stuff/amazing.jade that you want rendering to html, add "cool-stuff/amazing" to the array in frontend.json and Multicolour will generate a cool-stuff/amazing.html for you.

What data is passed into Jade as it compiles my templates?

When (all) your templates are compiled data is passed from the backend to the template:

{
    attributes: { ... Blueprint attributes ... },
    writable_attributes: { ... Blueprint attributes without id, createdAt or updatedAt ... },
    name: Blueprint identity, i.e "user",
    config: { Contents of config.js },
    package: { Contents of package.json },
    type_to_html_input_type: Function to convert basic attribute types to HTML input types,
    api_root: Full url to API
}