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

ang-tangle

v0.1.5

Published

tangles source files into an angular application

Downloads

5

Readme

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.

installation

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 init.coffee 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:

AngTangle.controller(function(...){...})

This will be invoked internally as:

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

usage

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

options:

    -v --verbose     be verbose

samples

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 rawgithub.com 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

https://github.com/pmuellr/ang-tangle

license

Apache License Version 2.0

http://www.apache.org/licenses/