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

grunt-angular-combine

v0.1.8

Published

Combine AngularJS partials into a single HTML file.

Downloads

31

Readme

grunt-angular-combine

Build Status: Linux

Combine AngularJS partials into a single HTML file.

This plugin is helpful for better performance in AngularJS template loading. You can use it to prepare templates for angular-combine.

Getting Started

This plugin requires Grunt ~0.4.1

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-angular-combine --save-dev

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

grunt.loadNpmTasks('grunt-angular-combine');

The "angularCombine" task

Overview

In your project's Gruntfile, add a section named angularCombine to the data object passed into grunt.initConfig().

grunt.initConfig({
  angularCombine: {
    combine: {
      files : [ {
        cwd : 'app/modules',
        src : [ 'module1/foo.html', 'module2/woot.html' ],
        dest : 'tmp/combined/modules.html'
      } ]
    }
  }
})

// or

grunt.initConfig({
  angularCombine: {
    combine: {
      files : [ {
        expand : true,
        cwd : 'app/modules',
        src : '*',
        dest : 'tmp/combined',
        filter : 'isDirectory'
      } ]
    },
  }
})

Options

The default process doesn't need any option but which folder or wich files should be processed.

processIdentifier

Type: function Default: function(id) { return id; }

grunt.initConfig({
  angularCombine : {
    combine : {
      options : {
        processIdentifier : function(id) {
          // just use the files name without extension as identifier
          return id.split('/').pop().replace('.html', '');
        }
      },
      files : [ {
        expand : true,
        cwd : 'app/modules',
        src : '*',
        dest : 'tmp/combined',
        filter : 'isDirectory'
      } ]
    }
  }
})

With the processIdentifier options, you can define the fragment id strategy. By default, with the following files structures :

* app/modules
  * module1/
    * module1-template1.html
    * module1-template2.html
    * module1-template3.html

you'll get those fragment id :

  • module1/module1-template1.html
  • module1/module1-template2.html
  • module1/module1-template3.html

With the function defined into options (like the example above, you'll get :

  • module1-template1
  • module1-template2
  • module1-template3

includeComments

Type: boolean Default: true

grunt.initConfig({
  angularCombine : {
    combineWithoutComment : {
      options : {
        includeComments : false
      },
      files : [ {
        expand : true,
        cwd : 'test/fixtures',
        src : 'combineWithoutComment',
        dest : 'tmp/combined',
        filter : 'isDirectory'
      } ]
    }
  }
})

This will remove the comment at the begining of the compiled files.
This should be a problem as template would certainly be minified anyway later in the delivery process.


### Usage Examples

Imagine a file structure like this :
  • app/modules
    • module1/
      • module1-template1.html
      • module1-template2.html
      • module1-template3.html
    • module2/
      • module2-template1.html
      • module2-template2.html

With this grunt config :

```js
grunt.initConfig({
  angularCombine : {
    combine : {
      files : [ {
        expand : true,
        cwd : 'app/modules',
        src : '*',
        dest : 'tmp/combined',
        filter : 'isDirectory'
      } ]
    }
  },
})

By using the filter isDirectory, the plugin will process all HTML files found into each directory of you selection. So that, you will get :

* tmp/combined
  * module1.html (containing the concatenation of module1-template1.html, module1-template2.html and module1-template3.html)
  * module2.html (containing the concatenation of module2-template1.html and module2-template2.html)

By defaults, it works in the current base directory.

Contributing

You'll find all contributors on this contributors page

Release History

See the changelog =)

Release process

The project use grunt-release for its versionning an tag process.