grunt-domman

0.1.5 • Public • Published

grunt-domman

Grunt plugin for DOM manipulation

Getting Started

安装插件:

npm install grunt-domman --save-dev

加载 grunt 任务:

grunt.loadNpmTasks('grunt-domman');

The "domman" task

Overview

在 Gruntfile.js 的 grunt.initConfig 中增加一个命名为 domman 的配置项:

grunt.initConfig({
  domman: {
    options: {
      plugins: ['tms', 'offline'], // 要启用的插件
      orderHead: ['offline', 'custom'], // 优先调用的插件
      orderTail: [], // 最后要调用的      插件
      custom: function ($) {
       $('title').text('xxx');
      },
    },
    files: [
      {...}
    ]
  },
})

配置项

options.plugins

Type: Array Default value: ['tms', 'offline', '...']

要调用的 dom 操作插件,在 grunt-domman 模块的 plugins 目录下,默认值为 plugins 目录下的所有插件。

options.orderHead

Type: Array Default value: []

需要首先调用的 plugins。

options.orderTail

Type: Array Default value: []

需要最后调用的 plugins。

options.custom

Type: Function Default value: null

用户自定义的 dom 操作,如果需要指定这个自定义的操作的位置,在 pluginsorderHeadorderTail 中指定 "custom" 字符串位置即可,默认最后执行

Release History

0.1.0

  • [!] 初始版本,支持 tmsoffline 插件

0.1.1

  • [!] 替换 options.prior 配置项为 options.orderHeadoptions.orderTail 两个配置项

0.1.2

  • [+] 支持 custom 配置项定制规则

0.1.4

  • [+] 更新 load.js 支持 js 脚本 onload 后加载
  • [!] offline.js 支持 angular seed 替换

0.1.5

  • [!] 更新 load.js 对包含 KISSY<script> 标签包含 <main> 的行内 js 默认做 onload 加载

License

Copyright (c) 2014 弘树. Licensed under the MIT license.

Readme

Keywords

Package Sidebar

Install

npm i grunt-domman

Weekly Downloads

2

Version

0.1.5

License

MIT

Last publish

Collaborators

  • dickeylth
  • bachi