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

gulp-tree-concat

v0.1.1

Published

Gulp processor to merge multiple javascript files into one with hierarchy

Downloads

1

Readme

gulp-tree-concat NPM version Build Status Dependency Status

A Gulp processor to merge multiple javascript files into one with hierarchy

Install

Install using npm.

$ npm install gulp-tree-concat

Usage

var jade = require('gulp-jade')
  , treeConcat = require('gulp-tree-concat')

gulp.task('template', function () {
  gulp.src('client/templates/**/*.jade')
    .pipe(jade({client:true, compileDebug: false}}))    
    .pipe(treeConcat({
      output: 'template.js',
      namespace: 'Views.JadeTemplates',
      hierarchy: true,
      nameTemplate: treeConcat.nameTemplates.relative('client/templates/')
    })
    .pipe(gulp.dest('public/assets'));
});

This compiles all of your jade template into a single file template.js as precompiled template, defining Views.JadeTemplates = { /* template fns */ }.

Let's say we have views located at

  • client/app/views/item.jade
  • client/app/views/admin/user.jade

Given the example's option as described before, those views will now be accessible as precompiled jade precompiled client template functions via

  • Views.JadeTemplates.item
  • Views.JadeTemplates.admin.user

(Please note that gulp-tree-concat only take cares to concat the compiled template, the jade template compiling is done by gulp-jade. And gulp-tree-concat doesn't have to be used in conjunction with gulp-jade. Any javascript files will do.)

Options

output

Type String

The output file name

namespace

Type String, default to this.Templates

The object that holds the concated templates gulp-tree-concat respects your namespace, it appends new members to the namespace one by one instead of override the whole object with =. So multiple output file can be loaded without conflict.

hierarchy

Type Boolean, default to false

Indicate whether the hierarchy should be built. If hierarchy is set to false in the sample, the template client/app/views/admin/user.jade will be stored as Views.JadeTemplates['admin/user'].

nameDivider

Type String, default to /

The name divider to parse the hierarchy from the name of the template. Could change to . to build hierarchy from filename. Since the value is used in RegExp, please escape it when necessary. Will be ignored if hierarchy is set to false

nameTemplate

Type function(File), (File) -> node name Mapping, default to treeConcat.path.none

The function to build the name for a file, usually the name is exctract from file name. But also could be extract from contents if necessary

Several predefined builder are included:

treeConcat.nameTemplates.fullpath()

Extract the file full path as template name /folder/file.js will be mapped to /folder/file.js

treeConcat.nameTemplates.filename(removeExtension = true)

Extract the file name as template name, extension name can be removed /folder/file.js will be mapped to file

Parameters

  • removeExtension controls how the extension is removed
    • true the extensions are removed
    • false the exensions are reserved
    • '.js' only the extensions matched are removed

treeConcat.nameTemplates.relative(baseFolder, removeExtension = true)

Extract the the relative path based on basedFolder, extension name can be removed /folder/subfolder/file.js will be mapped to subfolder/file

Parameters

  • baseFolder the relative path that you want to remove from name

  • removeExtension controls how the extension is removed

    • true the extensions are removed
    • false the exensions are reserved
    • '.js' only the extensions matched are removed

License

MIT

NPM downloads