Skip to content

Instantly share code, notes, and snippets.

@JiLiZART
Created May 23, 2016 09:45
Show Gist options
  • Save JiLiZART/126a9c60b8445d15c9b491d0ff80617d to your computer and use it in GitHub Desktop.
Save JiLiZART/126a9c60b8445d15c9b491d0ff80617d to your computer and use it in GitHub Desktop.
enb-exports-file.js
var fs = require('enb/lib/fs/async-fs'),
vow = require('vow'),
path = require('path');
module.exports = require('enb/lib/build-flow').create()
.name('enb-exports-file')
.target('target', '?.js')
.useSourceFilename('source', '?.txt')
.builder(function(cssFilename) {
var def = vow.defer();
return fs.read(cssFilename, 'utf8')
.then(function(data) {
var file = "module.exports = '" + data.replace(/\'/g,"\\'") + "';";
def.resolve(file);
return def.promise();
});
})
.createTech();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment