Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fabricator-assemble

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fabricator-assemble - npm Package Compare versions

Comparing version 0.1.3 to 0.1.5

helpers/helper-iterate.js

25

index.js

@@ -357,3 +357,28 @@ // modules

// get helper files
var resolveHelper = path.join.bind(null, __dirname, 'helpers');
var localHelpers = fs.readdirSync(resolveHelper());
var userHelpers = options.helpers;
// register local helpers
localHelpers.map(function (helper) {
var key = helper.match(/(^\w+?-)(.+)(\.\w+)/)[2];
var path = resolveHelper(helper);
Handlebars.registerHelper(key, require(path));
});
// register user helpers
for (var helper in userHelpers) {
if (userHelpers.hasOwnProperty(helper)) {
Handlebars.registerHelper(helper, userHelpers[helper]);
}
}
/**
* Helpers that require local functions like `buildContext()`
*/
/**
* `material`

@@ -360,0 +385,0 @@ * @description Like a normal partial include (`{{> partialName }}`),

3

package.json
{
"name": "fabricator-assemble",
"version": "0.1.3",
"version": "0.1.5",
"description": "The assembly engine behind Fabricator",

@@ -34,4 +34,5 @@ "main": "index.js",

"del": "^1.1.1",
"helper-markdown": "^0.1.1",
"mocha": "^2.1.0"
}
}

@@ -81,2 +81,3 @@ # Fabricator Assemble

docs: 'src/docs/**/*.md',
helpers: {},
dest: 'dist'

@@ -135,2 +136,25 @@ }

### options.helpers
Type: `Object`
Default: `{}`
User-defined helpers. E.g.:
```javascript
helpers: {
markdown: require('helper-markdown'),
foo: function () {
return 'bar';
}
}
```
### options.dest
Type: `String`
Default: `dist`
Destination of compiled views (where files are saved to)
## API

@@ -137,0 +161,0 @@

@@ -18,3 +18,6 @@ var assert = require('assert');

docs: './test/fixtures/docs/**/*',
dest: './test/output'
dest: './test/output',
helpers: {
markdown: require('helper-markdown')
}
};

@@ -30,9 +33,10 @@

assemble(options).done(function (data) {
var output = minify(fs.readFileSync('./test/output/index.html', 'utf-8'), { collapseWhitespace: true });
var expected = minify(fs.readFileSync('./test/expected/index.html', 'utf-8'), { collapseWhitespace: true });
assert.equal(output, expected);
done();
});
assemble(options);
var output = minify(fs.readFileSync('./test/output/index.html', 'utf-8'), { collapseWhitespace: true });
var expected = minify(fs.readFileSync('./test/expected/index.html', 'utf-8'), { collapseWhitespace: true });
assert.equal(output, expected);
done();
});

@@ -43,9 +47,10 @@

assemble(options).done(function (data) {
var output = minify(fs.readFileSync('./test/output/docs.html', 'utf-8'), { collapseWhitespace: true });
var expected = minify(fs.readFileSync('./test/expected/docs.html', 'utf-8'), { collapseWhitespace: true });
assert.equal(output, expected);
done();
});
assemble(options);
var output = minify(fs.readFileSync('./test/output/docs.html', 'utf-8'), { collapseWhitespace: true });
var expected = minify(fs.readFileSync('./test/expected/docs.html', 'utf-8'), { collapseWhitespace: true });
assert.equal(output, expected);
done();
});

@@ -56,9 +61,10 @@

assemble(options).done(function (data) {
var output = minify(fs.readFileSync('./test/output/pages/home.html', 'utf-8'), { collapseWhitespace: true });
var expected = minify(fs.readFileSync('./test/expected/home.html', 'utf-8'), { collapseWhitespace: true });
assert.equal(output, expected);
done();
});
assemble(options);
var output = minify(fs.readFileSync('./test/output/pages/home.html', 'utf-8'), { collapseWhitespace: true });
var expected = minify(fs.readFileSync('./test/expected/home.html', 'utf-8'), { collapseWhitespace: true });
assert.equal(output, expected);
done();
});

@@ -69,14 +75,25 @@

assemble(options).done(function (data) {
var output = minify(fs.readFileSync('./test/output/includes.html', 'utf-8'), { collapseWhitespace: true });
var expected = minify(fs.readFileSync('./test/expected/includes.html', 'utf-8'), { collapseWhitespace: true });
assert.equal(output, expected);
done();
});
assemble(options);
var output = minify(fs.readFileSync('./test/output/includes.html', 'utf-8'), { collapseWhitespace: true });
var expected = minify(fs.readFileSync('./test/expected/includes.html', 'utf-8'), { collapseWhitespace: true });
assert.equal(output, expected);
done();
});
});
it('should assemble with helpers', function (done) {
assemble(options);
var output = minify(fs.readFileSync('./test/output/helpers.html', 'utf-8'), { collapseWhitespace: true });
var expected = minify(fs.readFileSync('./test/expected/helpers.html', 'utf-8'), { collapseWhitespace: true });
assert.equal(output, expected);
done();
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc