Skip to content
This repository has been archived by the owner on Mar 25, 2018. It is now read-only.

Commit

Permalink
fix: rework docs
Browse files Browse the repository at this point in the history
  • Loading branch information
birhoff committed Feb 22, 2017
1 parent e92594c commit 91e4175
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ bem-xjst engines accesible via properties `bemhtml` and `bemtree`:
var engine = require('gulp-bem-xjst')[engine];
```

### Plugin options
### Options

* *String* **exportName** — Engine handler's variable name. Default — `BEMHTML`.
* *String* **engine** — Engine's name. Default — `BEMHTML`.
* *String* **exportName** — Engine handler's variable name.
* *String* **extension** — extension for file. Default — `.${engine}.js`.
* *Object* **engine** — XJST [options](https://github.com/bem/bem-xjst/blob/master/docs/en/3-api.md#settings).

### License

Expand Down
17 changes: 3 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ var PluginError = require('plugin-error');
var File = require('vinyl');
var isStream = require('is-stream');
var toArray = require('stream-to-array');
var deprecate = require('depd')(require('./package.json').name);

var formatError = require('./error');
var bundle = require('./lib/templates/bundle');
Expand All @@ -21,25 +20,15 @@ var pluginName = path.basename(__dirname);
* bem-xjst templates compiler.
*
* @param {Object} [options] - Options for generator.
* @param {String} [options.extension] - File extension. Default: engine name. Deprecated. Please use instead
* options.generator.extension
* @param {Object} [options.generator] - Generator options.
* @param {String} [options.generator.extension] - File extension. Default: engine name.
* @param {Object} [options.engine] - Engine compiler options. @see
* https://github.com/bem/bem-xjst/blob/master/docs/en/3-api.md#settings
* @param {String} [options.extension] - File extension. Default: engine name.
* @param {String} [options.exportName] - Name for export. Please notice if you set this option generated code will
* wrapped with CommonJS, YModules or Global
* @param {Object} [options.engine] - Engine compiler options. @see
* https://github.com/bem/bem-xjst/blob/master/docs/en/3-api.md#settings wrapped with CommonJS, YModules or Global
* @param {String|Function} engine - 'bemhtml' either 'bemtree' or any xjst-like engine function.
* @returns {Stream}
*/
module.exports = function(options, engine) {
options = options || {};
options.generator = options.generator || {};

if (options.extension) {
deprecate('options.extension: is deprecated. Please use `options.generator.extension` instead.');
options.generator = { extension: options.extension };
}

assert(typeof engine === 'string' || typeof (engine && engine.generate) === 'function', 'Invalid engine');

Expand Down

0 comments on commit 91e4175

Please sign in to comment.