All Projects → astik → grunt-angular-combine

astik / grunt-angular-combine

Licence: MIT license
Grunt task for combining AngularJS partials into a single HTML file.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to grunt-angular-combine

grunt-tv4
Use Grunt and Tiny Validator tv4 to validate files against json-schema draft v4
Stars: ✭ 13 (-18.75%)
Mutual labels:  grunt, grunt-plugins
grunt-search
Grunt plugin that searches a list of files and logs all findings in various formats.
Stars: ✭ 15 (-6.25%)
Mutual labels:  grunt, grunt-plugins
Openie Spider
Extract Information from web corpus using Open Information Extraction.
Stars: ✭ 174 (+987.5%)
Mutual labels:  fragments
SwiftReactor
A protocol which should help structure your data flow in SwiftUI (and UIKit).
Stars: ✭ 57 (+256.25%)
Mutual labels:  combine
feweekly
⭐ 前端周刊,让你在前端领域跟上时代的脚步,深度和广度不断精进
Stars: ✭ 34 (+112.5%)
Mutual labels:  grunt
Fragmentrigger
💥A powerful library powered by AOP to manage Fragments.(一个基于AOP设计的Fragment管理框架)
Stars: ✭ 2,260 (+14025%)
Mutual labels:  fragments
taskrunner.nvim
🏃 Runs Gulp/Gruntfiles in terminal splits
Stars: ✭ 13 (-18.75%)
Mutual labels:  gruntfile
Android Cheat Sheet
Cheat Sheet for Android Interviews
Stars: ✭ 1,891 (+11718.75%)
Mutual labels:  fragments
iOS-App
🕹️ iOS application of HardcoreTap game
Stars: ✭ 17 (+6.25%)
Mutual labels:  combine
Xpage
🔥A very useful Fragment page framework!(一个非常方便实用的fragment页面框架!)
Stars: ✭ 249 (+1456.25%)
Mutual labels:  fragments
protractor-element-extend
Module, that helps you to extend ElementFinder in your own custom fragments
Stars: ✭ 22 (+37.5%)
Mutual labels:  fragments
Base
🍁 Base是针对于Android开发封装好一些常用的基类,主要包括通用的Adapter、Activity、Fragment、Dialog等、和一些常用的Util类,只为更简单。
Stars: ✭ 249 (+1456.25%)
Mutual labels:  fragments
Wanandroid
WanAndroid客户端,项目基于 Material Design + MVP +dagger2 + RxJava + Retrofit + Glide + greendao 等架构进行设计实现,极力打造一款 优秀的玩Android https://www.wanandroid.com 客户端,是一个不错的Android应用开发学习参考项目
Stars: ✭ 223 (+1293.75%)
Mutual labels:  fragments
clouds
🌦 A weather app for iOS, written in SwiftUI.
Stars: ✭ 26 (+62.5%)
Mutual labels:  combine
Cicerone
🚦 Cicerone is a lightweight library that makes the navigation in an Android app easy.
Stars: ✭ 2,345 (+14556.25%)
Mutual labels:  fragments
danmallme
DanMall.me
Stars: ✭ 97 (+506.25%)
Mutual labels:  grunt
Expandingpager
ExpandingPager is a card peek/pop controller
Stars: ✭ 1,906 (+11812.5%)
Mutual labels:  fragments
Aboutlibraries
AboutLibraries automatically detects all dependencies of a project and collects their information including the license. Optionally visualising it via the provided ui components.
Stars: ✭ 2,777 (+17256.25%)
Mutual labels:  fragments
TypeScript-AMD-Boilerplate
A TypeScript AMD Grunt Boilerplate with RequireJS
Stars: ✭ 46 (+187.5%)
Mutual labels:  grunt
grunt-frontend-boilerplate
🔒 Basic boilerplate to start a webapp project with Angular.js, Bootstrap and Grunt
Stars: ✭ 14 (-12.5%)
Mutual labels:  grunt

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

Other similar projects

Release History

See the changelog =)

Release process

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].