# projmate-filters

> Official Projmate Filters

Latest version **0.0.8** (published 2013-03-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install projmate-filters
pnpm add projmate-filters
yarn add projmate-filters
bun add projmate-filters
```

## Health

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

Positive: no vulnerabilities.

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

Negative: insecure dependencies; abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.8 |
| Published | 2013-03-18 |
| First published | 2013-03-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 9 |
| Known vulnerabilities | 0 (+8 in 3 direct dependencies) |
| Install scripts | no |
| Author | Mario Gutierrez |
| Maintainers | mgutz |
| Keywords | Projmate, projmate-filter, build, project, templates |

## Links

- npm: https://www.npmjs.com/package/projmate-filters
- npm.io page: https://npm.io/package/projmate-filters

## Dependencies (9)

- [less](https://npm.io/package/less.md) ~1.3.3
- [async](https://npm.io/package/async.md) ~0.2.5
- [lodash](https://npm.io/package/lodash.md) ~1.0.1
- [recess](https://npm.io/package/recess.md) ~1.1.6
- [uglify-js](https://npm.io/package/uglify-js.md) ~2.2.5
- [consolidate](https://npm.io/package/consolidate.md) ~0.8.0
- [js-beautify](https://npm.io/package/js-beautify.md) ~0.3.5
- [coffee-script](https://npm.io/package/coffee-script.md) git://github.com/jashkenas/coffee-script.git#0120db0efc
- [dustjs-linkedin](https://npm.io/package/dustjs-linkedin.md) ~1.2.1

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.0.8 (latest) — 2013-03-18
- 0.0.7 — 2013-03-14
- 0.0.6 — 2013-03-08
- 0.0.5 — 2013-03-08
- 0.0.4 — 2013-03-06
- 0.0.1 — 2013-03-04

## README

# projmate-filters

Projmate supported filters.


## Filters

Filter          | Description
----------------|-------------
*addHeader*     | Adds buffer header.
*cat*           | Concatenates one or more buffers.
*coffee*        | Compiles CoffeeScript.
*commonJsify*   | Creates browser-compatible CommonJS package. Based on stitch.
*functoid*      | Create ad-hoc filters.
*less*          | Compile less scripts.
*loadFiles*     | Loads files into buffers.
*preproc*       | Preprocessor
*recess*        | Recess CSS tool
*template*      | Consolidate template engines (defaults to underscore)
*uglify*        | Javascript minifier, beautifier
*writeFiles*    | Writes files to file system.


## Filter

A `FileAsset` is a file based asset. Assets, for now, are from the
local file system but there is no reason an asset could not from the cloud
via a URL, or a database.

A `Filter` is reponsible for processing a single asset.

A `TaskProcessor` processes one or more assets and directly set properties
on a task. For example `commonJisfy`, `loadFiles` and `writeFiles` are
task processors as they manipulate multiple assets. `loadFiles` also sets
the initial assets for a task.


## Projmate filter v GruntJS plugin

Projmate filter

```coffeescript
module.exports = (Projmate) ->
  class Coffee extends Projmate.Filter
    extnames: ".coffee"
    outExtname: ".js"

    process: (asset, options, cb) ->
      try
        js = coffee.compile(asset.text, options)
        cb null, js
      catch ex
        cb ex
```

GruntJS plugin


```javascript
module.exports = function(grunt) {
  'use strict';

  grunt.registerMultiTask('coffee', 'Compile CoffeeScript files into JavaScript', function() {
    var path = require('path');

    var options = this.options({
      bare: false,
      separator: grunt.util.linefeed
    });

    if (options.basePath || options.flatten) {
      grunt.fail.warn('Experimental destination wildcards are no longer supported. please refer to README.');
    }

    grunt.verbose.writeflags(options, 'Options');

    this.files.forEach(function(f) {
      var output = f.src.filter(function(filepath) {
        // Warn on and remove invalid source files (if nonull was set).
        if (!grunt.file.exists(filepath)) {
          grunt.log.warn('Source file "' + filepath + '" not found.');
          return false;
        } else {
          return true;
        }
      }).map(function(filepath) {
        return compileCoffee(filepath, options);
      }).join(grunt.util.normalizelf(options.separator));

      if (output.length < 1) {
        grunt.log.warn('Destination not written because compiled files were empty.');
      } else {
        grunt.file.write(f.dest, output);
        grunt.log.writeln('File ' + f.dest + ' created.');
      }
    });
  });

  var compileCoffee = function(srcFile, options) {
    options = grunt.util._.extend({filename: srcFile}, options);

    if (require('path').extname(srcFile) === '.litcoffee') {
      options.literate = true;
    }

    var srcCode = grunt.file.read(srcFile);

    try {
      return require('coffee-script').compile(srcCode, options);
    } catch (e) {
      grunt.log.error(e);
      grunt.fail.warn('CoffeeScript failed to compile.');
    }
  };
};
```

## License

Copyright (c) 2013 Mario Gutierrez <mario@projmate.com>

See the file LICENSE for copying permission.

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