var fs = require('fs'),
    path = require('path'),
    browserify = require('browserify'),
    cardGenerator = require('./card-generator.js');

var script;
var cards;

exports.init = function(options) {
  // Write new cards file
  var cedict = fs.readFileSync(path.join(__dirname, 'assets/cedict/cedict_ts.u8'), 'utf-8'),
      vocabulary = fs.readFileSync(options.vocabularyFile, 'utf-8');
  cards = cardGenerator.generateCardsFromVocabulary(vocabulary);
  script = browserify(path.join(__dirname, 'lightcards/main.js'));
};

exports.pipe = function(stream) {
  script.bundle({
    insertGlobalVars: {
      cards: function() {
        return JSON.stringify(cards);
      }
    }
  }).pipe(stream);
};

var fs = require('fs'),
    path = require('path'),
    browserify = require('browserify'),
    cardGenerator = require('./card-generator.js');

var script;
var cards;

exports.init = function(options) {
  // Write new cards file
  var vocabulary = fs.readFileSync(options.vocabularyFile, 'utf-8');
  cards = cardGenerator.generateCardsFromVocabulary(vocabulary);
  script = browserify(path.join(__dirname, 'lightcards/main.js'));
};

exports.pipe = function(stream) {
  script.bundle({
    insertGlobalVars: {
      cards: function() {
        return JSON.stringify(cards);
      }
    }
  }).pipe(stream);
};

Remove old reference to cedict file
Remove old reference to cedict file

Change-Id: I3fc1682679b99c8a188be8d848990b7de8346b33
