tangles source files into an angular application
Last updated 6 years ago by pmuellr .
Apache License · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ang-tangle 
SYNC missed versions from official npm registry.

ang-tangle - tangles source files into an angular application

ang-tangle is a tool that can collect your static JavaScript, HTML, and JSON resources for an AngularJS-based application into a single .js file, and associated sourcemap for debugging.


Install globally via:

sudo npm -g install ang-tangle

(note: sudo not needed for windows)

This will install a global command ang-tangle.

If you just want to use it as a tool within your project, you can of course install locally instead of globally (ie, don't use the -g flag).

what it does

You run ang-tangle by passing the name of a directory which contains your angular JavaScript scripts, HTML files, and JSON data files. ang-tangle can also handle CoffeeScript and Markdown files.

From here in, we'll reference this directory as the "input directory".

In your project, you should create a new directory - the input directory - to store these angular resources; and just these angular resources. ang-tangle doesn't handle images, css files, etc. It only handles the following files:

  • .js
  • .coffee
  • .litcoffee
  • .html
  • .md
  • .json

The input directory should have at least one script in it - init.js (or or init.litcoffee), which is a script which should create your angular module.

The rest of your angular scripts can be in the input directory also, or any subdirectory of the input directory.

ang-tangle will also take .html and .md files in any directory, and make them available via a service named views. The views service is an object whose properties are the names of the .html or .md files relative to the input directory, and the values are the contents of the files.

ang-tangle will also take .json files in any directory, and make them available via a service named data. The data service is an object whose properties are the names of the .json files relative to the input directory, and values are the JSON.parse()d objects of those files.

the AngTangle object

Your scripts have access to a object named AngTangle. The AngTangle object has the same methods as the angular module object, and is bound to the module you create in the init script.

There is one additional method on the AngTangle object - module(), which is used to create the module in init script. The signature is the same as the angular.module() function.

You should create your angular module with:

AngTangle.module(name[, requires], configFn)

just like you do with angular.module().

If you call the module() function with no arguments, it will return the module you previously created with AngTangle.module(...).

Another goodie is that various registration methods of the angular module object, like Module::service() can be used without the name parameter. The name used when making the actual call will be the name of the script, without any path or extension. For instance, if you have file views/hello.js, whose contents are:


This will be invoked internally as:

AngTangle.module().controller("hello", function(...){...})


ang-tangle [options] input-directory output-file

    input-directory is a directory of files to ang-tangle-ize
    output-file     is the name of the file to be generated


    -v --verbose     be verbose


There are two sample applications available with the project. Check the samples directory.

You should be able to run the finished samples in your browser using the awesome service.

building ang-tangle

To hack on ang-tangle code itself, you should first install jbuild. Then run npm install, or course.

Run jbuild by itself in the project directory to see the tasks available.

ang-tangle home


Apache License Version 2.0

Current Tags

  • 0.1.5                                ...           latest (6 years ago)

3 Versions

  • 0.1.3                                ...           7 years ago
  • 0.1.5                                ...           6 years ago
  • 0.1.4                                ...           6 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (6)
Dev Dependencies (0)
Dependents (1)

Copyright 2014 - 2016 © |