# crox-grunt

> Crox task plugin for Grunt.

Latest version **0.1.8** (published 2016-02-03) · 0 weekly downloads

## Install

```sh
npm install crox-grunt
pnpm add crox-grunt
yarn add crox-grunt
bun add crox-grunt
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.8 |
| Published | 2016-02-03 |
| First published | 2014-03-02 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.17 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | wangjeaf |
| Maintainers | wangjeaf |
| Keywords | Crox, Grunt, Task, Watch |

## Links

- npm: https://www.npmjs.com/package/crox-grunt
- Repository: https://github.com/wangjeaf/crox-grunt
- Issues: https://github.com/wangjeaf/crox-grunt/issues
- npm.io page: https://npm.io/package/crox-grunt

## Dependencies (2)

- [crox](https://npm.io/package/crox.md) ^1.4.4
- [js-beautify](https://npm.io/package/js-beautify.md) ~1.4.0

## Recent versions

- 0.1.8 (latest) — 2016-02-03
- 0.1.7 — 2014-03-02
- 0.1.6 — 2014-03-02

## README

crox-grunt
==================

Crox 的 Grunt插件

## Crox任务的options说明

- `target` 翻译的目标语言，可同时翻译成多个，用 `,` 隔开。目前支持： `php` | `vm` | `nodejs`(`commonjs`) | `cmd`(`seajs`) | `amd`(`requirejs`) | `kissy` | `kissyfn`

- `modulePrefix` 根模块前缀指定，例如 `app/sub/module/b` 的 `app`（主要用于js模块的翻译）

- `htmlEncode` 翻译的js代码中的html特殊字符转义方法（主要用于js相关翻译）

- `flatten` 是否把include都打平（读取真实文件内容替换）

## Gruntfile.js Demo

*由于使用了grunt-newer插件，请注意newer:crox:go*

```js
module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    crox: {
        options: {
            target: 'vm,nodejs',
            modulePrefix: 'app',
            htmlEncode: 'myHtmlEncode',
            flatten: true
        },
        go: {
            src: ['./test/**/*.tpl']
        }
    },
    watch: {
        crox: {
            files: ['<%= crox.go.src %>'],
            tasks: ['newer:crox:go']
        }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-watch'); 
  grunt.loadNpmTasks('crox-grunt'); 
  grunt.loadNpmTasks('grunt-newer');
  grunt.registerTask('default', ['watch']);
};
```

## 使用

- `grunt watch` 开启 `watch`，实时检测Crox模板文件改动

- `grunt crox` 执行所有匹配文件的翻译

## package.json Demo

```js
{
  "name": "test-crox-grunt",
  "dependencies": {
    "crox": "^1.4.4",
    "grunt": "~0.4.2",
    "grunt-contrib-watch": "*",
    "crox-grunt": "*"
  }
}
```

---
_Source: https://npm.io/package/crox-grunt · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
