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

nodulator-assets

v0.0.9

Published

Assets management for Nodulator

Downloads

4

Readme

Nodulator-Assets

Assets and views automatic management system for Nodulator

Master : Build Status

Develop: Build Status

NPM: npm version

Released under GPLv2

Concept

Provides ability to Nodulator to render views and auto-load assets in following folders:

  • Nodulator.config.js: array for js (or coffee) files
  • Nodulator.config.css: array for css files
  • Nodulator.config.viewRoot: path for index.jade

Features

  • Automatic js and css assets loading
  • Provides methods for modules to add folders to assets management
  • Provides basic view system (only 'Nodulator.config.viewRoot/index.jade' for the moment)
  • Add a Nodulator.Run() method to be called last for view rendering
  • Add a Nodulator.ExtendBeforeRun() and Nodulator.ExtendAfterRun() method for modules to add instructions at the begining of Run() or just before Render()
  • Add a Nodulator.ExtendBeforeRender() and Nodulator.ExtendAfterRender() method for modules to add instructions at the begining of Render() or just before the actual res.render()
  • CoffeeScript automatic compilation on fly
  • Jade automatic compilation on fly (no other engines yet)

JumpTo


Installation

You can automaticaly install Nodulator and Nodulator-Assets by running

$> sudo npm install -g Nodulator
$> Nodulator install assets

Or you can just run npm :

$> npm install nodulator nodulator-assets

Basics

Nodulator = require 'nodulator'
Assets = require 'nodulator-assets'

# Default config, can be omited
Nodulator.Config
  viewRoot: 'client'
  js: ['/client/public/js/', '/client/']
  css: ['/client/public/css/']
  engine: 'jade' # no other engines at the moment

Nodulator.Use Assets

# New method, to be called last for rendering
Nodulator.Run()

In index.jade, you must always call | !{nodulator()} at the end of the file.

It's there that all Nodulator-Assets magic stuff occur, and the only call you'll ever have to do in views.


Project Generation

See Nodulator's project generation

When calling $> Nodulator init, it will automaticaly create following structure if non-existant:

client
├── index.jade
└── public
    ├── css
    ├── img
    └── js

Module Hacking

The module is stored in Nodulator.assets and provides following methods :

  # Add folders given in list to assets list
  Nodulator.assets.AddFolder (list) ->

  # Add folders given in list to assets list, the recursive way
  Nodulator.assets.AddFolderRec (list) ->

Exemple of asset list : (paths are relative to project root)

  list =
    '/js/app.js': ['/client/folder1/']
    '/css/app.css': ['/client/public/css/']

TODO

  • Test suite
  • Image (and other static assets) management
  • Split assets between head and body tags

Changelog

XX/XX/XX: Current (not released yet)

  • Added a parameter to view nodulator() function to get a specific set of assets

12/02/15: v0.0.9

  • Added fake tests
  • Updated README

03/01/15: v0.0.8

  • Added Nodulator.ExtendBeforeRender() and Nodulator.ExtendAfterRender() to precisely extend render process.

02/01/15: v0.0.7

  • Updated README

02/01/15: v0.0.6

  • Changed Nodulator.ExtendRunProcess into Nodulator.ExtendBeforeRun
  • Added Nodulator.ExtendAfterRun
  • That fixes cachify_js bug if another render is processed

02/01/15: v0.0.5

  • Added index.jade file generation
  • Changed the way folders are configurated
  • Improved README
  • Files are automaticaly loaded by !{nodulator()} call
  • Added automatic compilation of views