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 🙏

© 2026 – Pkg Stats / Ryan Hefner

grunt-asset-linker

v0.1.0

Published

Traverses through your markup and automatically links in your assets (scripts/styles/images)

Downloads

21

Readme

asset-linker (grunt-asset-linker)

Automatically inject tags of any kind into your markup, and tag distributions while you're at it.

HOLD UP!

This README is somewhat out of date. If in doubt, inspect the code.

Getting Started

This plugin requires Grunt ~0.4.x

When the task is run the destination file(s) is updated with script tags pointing to all the source files. The reason this plugin was built was to automate the process of inserting script tags when building large web apps.

npm install grunt-asset-linker --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-asset-linker');

Using the "asset-linker" task

Overview

In your project's Gruntfile, add an asset-linker linker block like so:

grunt.initConfig({
  'sails-linker': {
    default: {
      options: {
        start: '<!--SCRIPTS-->', // Asset boundry start
        end: '<!--SCRIPTS END-->', //Asset boundry end
        template: '<script src="%s"></script>',
        root: 'app/'
      },
      files: {
        // Target files, and specify which assets to inject into them.
        'app/index.html': ['app/public/scripts/**/*.js']
      },
    },
  },
})

Assuming you have the following files in the app/public/scripts directory:

  • init.js
  • my_awesome_library.js
  • vendor/jquery.min.js

The following file (app/index.html):

<!doctype html>
<html lang="en">
<head>...</head>
<body>
  ...
  <!--SCRIPTS-->
  <!--SCRIPTS END-->
</body>
</html>

Would suddenly become

<!doctype html>
<html lang="en">
<head>...</head>
<body> 
  ...
  <!--SCRIPTS-->
  <script src="init.js"></script>
  <script src="my_awesome_library.js"></script>
  <script src="vendor/jquery.min.js"></script>
  <!--SCRIPTS END-->
</body>
</html>

(See how the /app was stripped out? That's because we specified it as the root above)

Options

options.start

Type: String Default value: '<!--SCRIPTS-->'

Asset tags will be placed between this boundry, and options.end

options.end

Type: String Default value: '<!--SCRIPTS END-->'

The lower boundry for the asset groups

options.template

Type: String Default value: '<script src="%s"></script>'

The template used to insert the links to assets. Notice that the first formatting operator (%s) will be replaced with the actual link

options.root

Type: String Default value: ''

The root of the application. Links are relative to this folder.

options.relative

Type: Boolean Default value: false

Reference files using a relative URI instead of an absolute one.

options.verifyExists

Type: Boolean Default value: true

Whether or not to verify that the specified files to inject actually exist on the filesystem.

options.verifyExists

Type: Boolean Default value: true

Whether or not to verify that the specified files to inject actually exist on the filesystem.